Skip to content

Update Version Badge #3

Update Version Badge

Update Version Badge #3

name: Update Version Badge
on:
workflow_run:
workflows: ["Bump Tag"]
types: [completed]
branches:
- main
jobs:
update-version-badge:
runs-on: ubuntu-latest
if: github.event.workflow_run.conclusion == 'success'
steps:
- name: checkout
uses: actions/checkout@v3
- name: get the latest tag
id: get_latest_tag
run: echo "::set-output name=TAG::$(git describe --tags `git rev-list --tags --max-count=1`)"
- name: write version file
run: |
echo '{"label": "version", "message": "${{ steps.get_latest_tag.outputs.TAG }}"}' > .github/badges/version.json
- name: commit and push
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'actions@github.com'
git add .github/badges/version.json
git commit -m "Update version badge to ${{ steps.get_latest_tag.outputs.TAG }}"
git push