diff --git a/.github/workflows/update-version-and-create-tag.yml b/.github/workflows/update-version-and-create-tag.yml index 3acf2517..2aa4e4fe 100644 --- a/.github/workflows/update-version-and-create-tag.yml +++ b/.github/workflows/update-version-and-create-tag.yml @@ -1,4 +1,4 @@ -name: Update Version and Create Tag +name: Update Version File and Create Tag on: push: @@ -28,30 +28,28 @@ jobs: run: | latest_tag=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0") echo "Latest tag is: $latest_tag" - echo "::set-output name=tag::$latest_tag" + echo "tag=$latest_tag" >> $GITHUB_ENV # Save the latest tag to environment file - - name: Increment minor version + - name: Increment patch version id: increment_version run: | - latest_tag=${{ steps.get_latest_tag.outputs.tag }} - IFS='.' read -r major minor patch <<<"${latest_tag#v}" - new_minor=$((minor + 1)) - new_tag="v${major}.${new_minor}.0" + IFS='.' read -r major minor patch <<<"${{ env.tag#v }}" + new_patch=$((patch + 1)) + new_tag="v${major}.${minor}.${new_patch}" echo "New tag is: $new_tag" - echo "::set-output name=new_tag::$new_tag" + echo "new_tag=$new_tag" >> $GITHUB_ENV # Save the new tag to environment file - name: Update version.go file run: | - new_tag=${{ steps.increment_version.outputs.new_tag }} commit_hash=$(git rev-parse --short HEAD) echo "package main" > version.go echo "" >> version.go - echo "var version = \"${new_tag}-${commit_hash}\"" >> version.go + echo "var version = \"${{ env.new_tag }}-${commit_hash}\"" >> version.go - name: Commit changes run: | git add version.go - git commit -m "Update version to ${{ steps.increment_version.outputs.new_tag }} and commit $commit_hash" + git commit -m "Update version to ${{ env.new_tag }} and commit $commit_hash" - name: Push changes env: @@ -63,6 +61,5 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - new_tag=${{ steps.increment_version.outputs.new_tag }} - git tag $new_tag - git push origin $new_tag # Push the new tag + git tag ${{ env.new_tag }} + git push origin ${{ env.new_tag }} # Push the new tag