Skip to content

Commit

Permalink
feat: add version updater bot
Browse files Browse the repository at this point in the history
  • Loading branch information
eugeis committed Sep 29, 2024
1 parent 2f881a2 commit 8445b6a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions .github/workflows/update-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main # Or whichever branch you want to monitor

permissions:
contents: write # Ensure the workflow has write permissions

jobs:
update-version:
runs-on: ubuntu-latest
Expand All @@ -23,20 +26,18 @@ jobs:
- name: Get the latest tag
id: get_latest_tag
run: |
ls -all
latest_tag=$(git describe --tags --abbrev=0)
echo "Latest tag is: $latest_tag"
echo "::set-output name=tag::$latest_tag"
- name: Get the latest commit hash
id: get_commit_hash
run: |
ls -all
commit_hash=$(git rev-parse --short HEAD)
echo "Commit hash is: $commit_hash"
echo "::set-output name=commit_hash::$commit_hash"
- name: Update version file
- name: Update version.go file
run: |
latest_tag=${{ steps.get_latest_tag.outputs.tag }}
commit_hash=${{ steps.get_commit_hash.outputs.commit_hash }}
Expand All @@ -48,4 +49,9 @@ jobs:
run: |
git add version.go
git commit -m "Update version to ${{ steps.get_latest_tag.outputs.tag }} and commit ${{ steps.get_commit_hash.outputs.commit_hash }}"
git push origin main # Or the relevant branch
- name: Push changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Use GITHUB_TOKEN to authenticate the push
run: |
git push origin main # Or the relevant branch

0 comments on commit 8445b6a

Please sign in to comment.