-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3deb19
commit ebb3f54
Showing
2 changed files
with
18 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,42 +17,25 @@ jobs: | |
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 | ||
- name: Read and bump version in Makefile | ||
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 | ||
# Read current version from Makefile | ||
CURRENT_VERSION=$(grep -E "^VERSION\s*=" Makefile | awk -F '=' '{print $2}' | xargs) | ||
echo "Current version: $CURRENT_VERSION" | ||
# Increment the patch version | ||
IFS='.' read -r MAJOR MINOR PATCH <<< "$CURRENT_VERSION" | ||
PATCH=$((PATCH + 1)) | ||
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 | ||
echo "Bumping version to: $NEW_VERSION" | ||
|
||
# Update the Makefile with the new version | ||
sed -i "s/^VERSION\s*=.*/VERSION = $NEW_VERSION/" Makefile | ||
|
||
- name: Commit and push changes | ||
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 }} | ||
git commit -am "Bump version to $NEW_VERSION" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters