Skip to content

Commit

Permalink
feat: clean up html readability; add autm. tag creation
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeis committed Oct 2, 2024
1 parent 857b23c commit 689292f
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions .github/workflows/update-version-and-create-tag.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Update Version and Create Tag
name: Update Version File and Create Tag

on:
push:
Expand Down Expand Up @@ -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:
Expand All @@ -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

0 comments on commit 689292f

Please sign in to comment.