Skip to content

bump version move to seperate flow #3

bump version move to seperate flow

bump version move to seperate flow #3

Workflow file for this run

name: Bump Version
on:
push:
branches:
- master
pull_request:
permissions:
contents: write
jobs:
update_version:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Fetch tags from master
run: |
git fetch origin master --tags # Fetch tags from the master branch
LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1) master)
echo "LATEST_TAG=${LATEST_TAG}" >> $GITHUB_ENV
- name: Extract and Increment Version
id: increment_version
run: |
TAG=${LATEST_TAG}
# Strip the "v" prefix if it exists and split the version into components
VERSION=${TAG#v}
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
# Increment the patch version by 2
PATCH=$((PATCH + 2))
# Create the new version
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
# Export the new version to the environment
echo "NEW_VERSION=${NEW_VERSION}" >> $GITHUB_ENV
- name: Update version in GNUmakefile
run: |
sed -i "s|\(/registry.terraform.io/frontegg/frontegg/\)[^/]*|\1${{ env.NEW_VERSION }}|" GNUmakefile
- name: Configure Git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
- name: Commit updated GNUmakefile
run: |
git commit -am "Update GNUmakefile version to ${{ env.NEW_VERSION }}"
git push origin ${{ github.event.pull_request.head.ref }}