Skip to content

Commit

Permalink
changed all
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexFrontegg committed Dec 10, 2024
1 parent c3deb19 commit ebb3f54
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 34 deletions.
49 changes: 16 additions & 33 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 2 additions & 1 deletion GNUmakefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
PLATFORM ?= $(shell go env GOOS)_$(shell go env GOARCH)
VERSION = 1.0.5

default: testacc

install:
@go build -o ~/.terraform.d/plugins/registry.terraform.io/frontegg/frontegg/merge..2/$(PLATFORM)/terraform-provider-frontegg
@go build -o ~/.terraform.d/plugins/registry.terraform.io/frontegg/frontegg/$(VERSION)/$(PLATFORM)/terraform-provider-frontegg
@rm .terraform.lock.hcl

.PHONY: testacc
Expand Down

0 comments on commit ebb3f54

Please sign in to comment.