Check for New Bouncer Release #124
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: Check for New Bouncer Release | |
| on: | |
| schedule: | |
| - cron: '0 3 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| check-release: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| - name: Get latest bouncer release tag | |
| id: check | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| UPSTREAM_TAG=$(gh api /repos/hslatman/caddy-crowdsec-bouncer/releases/latest --jq .tag_name) | |
| VERSION=${UPSTREAM_TAG#v} | |
| echo "Latest Upstream Version: $VERSION" | |
| # Checks repo tags for 'b{VERSION}-' (e.g., b0.10.0-) | |
| if gh release list --json tagName --jq '.[].tagName' | grep -q -- "-b${VERSION}-"; then | |
| echo "✅ Release containing b${VERSION}- already exists. Skipping build." | |
| echo "trigger=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "🚀 New Bouncer version ${VERSION} detected! Triggering build." | |
| echo "trigger=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Trigger build workflow | |
| if: steps.check.outputs.trigger == 'true' | |
| uses: peter-evans/repository-dispatch@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| event-type: bouncer-release |