build: specify tags in workflow #2
Workflow file for this run
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
--- | |
jobs: | |
goreleaser: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
with: | |
fetch-depth: 0 | |
- run: git fetch --force --tags | |
- uses: actions/setup-go@v5.0.0 | |
with: | |
cache: true | |
go-version: ">=1.20.2" | |
- uses: sigstore/cosign-installer@v3.4.0 | |
with: | |
cosign-release: v2.0.0 | |
- uses: anchore/sbom-action/download-syft@v0.15.18 | |
with: | |
syft-version: v0.69.0 | |
- id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6.1.0 | |
with: | |
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.PASSPHRASE }} | |
- env: | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
run: echo "$GPG_PRIVATE_KEY" > /home/runner/gpgkey.asc && chmod 600 /home/runner/gpgkey.asc | |
shell: bash | |
- uses: docker/login-action@v3.0.0 | |
with: | |
password: ${{ secrets.GH_PAT }} | |
registry: ghcr.io | |
username: mcornick | |
- env: | |
AUR_KEY: ${{ secrets.AUR_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GH_PAT }} | |
MASTODON_ACCESS_TOKEN: ${{ secrets.MASTODON_ACCESS_TOKEN }} | |
MASTODON_CLIENT_ID: ${{ secrets.MASTODON_CLIENT_ID }} | |
MASTODON_CLIENT_SECRET: ${{ secrets.MASTODON_CLIENT_SECRET }} | |
id: goreleaser | |
uses: goreleaser/goreleaser-action@v5.0.0 | |
with: | |
args: release --clean | |
version: latest | |
- run: rm /home/runner/gpgkey.asc | |
shell: bash | |
- name: Generate binary hashes | |
id: binary | |
env: | |
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}" | |
run: |- | |
set -euo pipefail | |
checksum_file=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Checksum") | .path') | |
echo "hashes=$(cat $checksum_file | base64 -w0)" >> "$GITHUB_OUTPUT" | |
- name: Image digest | |
id: image | |
env: | |
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}" | |
run: |- | |
set -euo pipefail | |
image_and_digest=$(echo "$ARTIFACTS" | jq -r '.[] | select (.type=="Docker Manifest") | .path') | |
image=$(echo "${image_and_digest}" | cut -d'@' -f1 | cut -d':' -f1) | |
digest=$(echo "${image_and_digest}" | cut -d'@' -f2) | |
echo "name=$image" >> "$GITHUB_OUTPUT" | |
echo "digest=$digest" >> "$GITHUB_OUTPUT" | |
binary-provenance: | |
needs: [goreleaser] | |
permissions: | |
actions: read | |
id-token: write | |
contents: write | |
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v1.9.0 | |
with: | |
base64-subjects: "${{ needs.goreleaser.outputs.hashes }}" | |
upload-assets: true | |
image-provenance: | |
needs: [goreleaser] | |
permissions: | |
actions: read | |
id-token: write | |
packages: write | |
secrets: | |
registry-password: ${{ secrets.GITHUB_TOKEN }} | |
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@v1.9.0 | |
with: | |
image: ${{ needs.goreleaser.outputs.image }} | |
digest: ${{ needs.goreleaser.outputs.digest }} | |
registry-username: ${{ github.actor }} | |
name: goreleaser | |
"on": | |
push: | |
tags: | |
- "*" | |
permissions: | |
contents: write | |
id-token: write | |
issues: write | |
packages: write | |
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json |