Update Version Badge #4
This file contains hidden or 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: | |
| schedule: | |
| # Run daily at 6 AM UTC | |
| - cron: '0 6 * * *' | |
| workflow_dispatch: # Allow manual trigger | |
| push: | |
| branches: [master] | |
| paths: | |
| - '.github/workflows/update-version-badge.yml' | |
| jobs: | |
| update-badge: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Fetch latest Beeper version | |
| id: beeper | |
| run: | | |
| DOWNLOAD_URL=$(curl -Ls -o /dev/null -w "%{url_effective}" \ | |
| "https://api.beeper.com/desktop/download/linux/x64/stable/com.automattic.beeper.desktop") | |
| VERSION=$(echo "$DOWNLOAD_URL" | grep -oP 'Beeper-\K[0-9]+\.[0-9]+\.[0-9]+') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Latest Beeper version: $VERSION" | |
| - name: Update badge JSON | |
| run: | | |
| mkdir -p .github/badges | |
| cat > .github/badges/beeper-version.json << EOF | |
| { | |
| "schemaVersion": 1, | |
| "label": "Beeper Latest", | |
| "message": "${{ steps.beeper.outputs.version }}", | |
| "color": "blue" | |
| } | |
| EOF | |
| cat .github/badges/beeper-version.json | |
| - name: Commit if changed | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add .github/badges/beeper-version.json | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| else | |
| git commit -m "chore: Update Beeper version badge to ${{ steps.beeper.outputs.version }}" | |
| git push | |
| fi |