feat: add version updater bot
This commit is contained in:
parent
2f881a2c06
commit
8445b6aad7
12
.github/workflows/update-version.yml
vendored
12
.github/workflows/update-version.yml
vendored
@ -5,6 +5,9 @@ on:
|
|||||||
branches:
|
branches:
|
||||||
- main # Or whichever branch you want to monitor
|
- main # Or whichever branch you want to monitor
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write # Ensure the workflow has write permissions
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-version:
|
update-version:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -23,7 +26,6 @@ jobs:
|
|||||||
- name: Get the latest tag
|
- name: Get the latest tag
|
||||||
id: get_latest_tag
|
id: get_latest_tag
|
||||||
run: |
|
run: |
|
||||||
ls -all
|
|
||||||
latest_tag=$(git describe --tags --abbrev=0)
|
latest_tag=$(git describe --tags --abbrev=0)
|
||||||
echo "Latest tag is: $latest_tag"
|
echo "Latest tag is: $latest_tag"
|
||||||
echo "::set-output name=tag::$latest_tag"
|
echo "::set-output name=tag::$latest_tag"
|
||||||
@ -31,12 +33,11 @@ jobs:
|
|||||||
- name: Get the latest commit hash
|
- name: Get the latest commit hash
|
||||||
id: get_commit_hash
|
id: get_commit_hash
|
||||||
run: |
|
run: |
|
||||||
ls -all
|
|
||||||
commit_hash=$(git rev-parse --short HEAD)
|
commit_hash=$(git rev-parse --short HEAD)
|
||||||
echo "Commit hash is: $commit_hash"
|
echo "Commit hash is: $commit_hash"
|
||||||
echo "::set-output name=commit_hash::$commit_hash"
|
echo "::set-output name=commit_hash::$commit_hash"
|
||||||
|
|
||||||
- name: Update version file
|
- name: Update version.go file
|
||||||
run: |
|
run: |
|
||||||
latest_tag=${{ steps.get_latest_tag.outputs.tag }}
|
latest_tag=${{ steps.get_latest_tag.outputs.tag }}
|
||||||
commit_hash=${{ steps.get_commit_hash.outputs.commit_hash }}
|
commit_hash=${{ steps.get_commit_hash.outputs.commit_hash }}
|
||||||
@ -48,4 +49,9 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
git add version.go
|
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 commit -m "Update version to ${{ steps.get_latest_tag.outputs.tag }} and commit ${{ steps.get_commit_hash.outputs.commit_hash }}"
|
||||||
|
|
||||||
|
- 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
|
git push origin main # Or the relevant branch
|
Loading…
x
Reference in New Issue
Block a user