Update Version Badge #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |