release / goreleaser #17
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
| # Unified release workflow: master push releases + nightly scheduled releases. | |
| # Replaces the old releaser-master.yml and releaser-nightly.yml. | |
| name: release / goreleaser | |
| on: | |
| push: | |
| branches: | |
| - master | |
| schedule: | |
| - cron: "0 0 * * 2-6" # nightly Tue-Sat | |
| workflow_dispatch: | |
| inputs: | |
| snapshot: | |
| description: "Build as snapshot (no publish)" | |
| required: false | |
| type: boolean | |
| default: false | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref || github.run_id }} | |
| permissions: | |
| contents: write # needed to write releases | |
| id-token: write # needed for keyless signing | |
| packages: write # needed for ghcr access | |
| jobs: | |
| goreleaser: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v5 | |
| with: | |
| fetch-depth: 0 | |
| # Dummy tag needed for goreleaser on non-tag pushes | |
| - name: Create a dummy tag to avoid goreleaser failure | |
| if: github.event_name == 'push' | |
| run: git tag v0.0.0 master | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - uses: sigstore/cosign-installer@v3.9.2 | |
| - uses: anchore/sbom-action/download-syft@v0.20.5 | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Determine release args | |
| id: args | |
| run: | | |
| if [ "${{ github.event_name }}" = "schedule" ] || [ "${{ inputs.snapshot }}" = "true" ]; then | |
| echo "goreleaser-args=release --clean --nightly --snapshot --config ./.github/goreleaser.yaml" >> $GITHUB_OUTPUT | |
| echo "tag-version=nightly" >> $GITHUB_OUTPUT | |
| else | |
| echo "goreleaser-args=release --clean --nightly --config ./.github/goreleaser.yaml" >> $GITHUB_OUTPUT | |
| echo "tag-version=master" >> $GITHUB_OUTPUT | |
| fi | |
| - uses: goreleaser/goreleaser-action@v6 | |
| with: | |
| distribution: goreleaser-pro | |
| version: ~> v2 | |
| args: ${{ steps.args.outputs.goreleaser-args }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | |
| TAG_VERSION: ${{ steps.args.outputs.tag-version }} |