From ebb3f54aeeccae14bef4ff8da5bb3ca37e15e4d3 Mon Sep 17 00:00:00 2001 From: AlexFrontegg Date: Tue, 10 Dec 2024 16:36:39 +0200 Subject: [PATCH] changed all --- .github/workflows/bump-version.yml | 49 ++++++++++-------------------- GNUmakefile | 3 +- 2 files changed, 18 insertions(+), 34 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index c761ebc..2a30585 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -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 "actions@github.com" - - - 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 diff --git a/GNUmakefile b/GNUmakefile index 9c58400..f0d91fb 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -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