feat(ci): trigger profile README update on release via repository_dis… #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
| # Runs GoReleaser on version tag pushes (v*.*.*) to publish | ||
| # cross-platform binaries for linux, macOS, and Windows. | ||
| # After a successful release, fires a repository_dispatch event to the | ||
| # profile repo so the README is updated immediately with the new version. | ||
| name: Release | ||
| on: | ||
| push: | ||
| tags: | ||
| - "v*.*.*" | ||
| jobs: | ||
| release: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| - uses: actions/setup-go@v5 | ||
| with: | ||
| go-version-file: go.mod | ||
| - uses: goreleaser/goreleaser-action@v6 | ||
| with: | ||
| version: latest | ||
| args: release --clean | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
| - name: Trigger profile README update | ||
| if: ${{ secrets.PROFILE_DISPATCH_TOKEN != '' }} | ||
| env: | ||
| PROFILE_DISPATCH_TOKEN: ${{ secrets.PROFILE_DISPATCH_TOKEN }} | ||
| run: | | ||
| PROFILE_REPO="${{ github.repository_owner }}/${{ github.repository_owner }}" | ||
| curl -s -o /dev/null -w "%{http_code}" -X POST \ | ||
| -H "Authorization: Bearer $PROFILE_DISPATCH_TOKEN" \ | ||
| -H "Accept: application/vnd.github+json" \ | ||
| "https://api.github.com/repos/${PROFILE_REPO}/dispatches" \ | ||
| -d "{\"event_type\":\"livemark-release\",\"client_payload\":{\"version\":\"${{ github.ref_name }}\"}}" | ||