Skip to content

Merge pull request #77 from smlx/dependabot/github_actions/github-act… #19

Merge pull request #77 from smlx/dependabot/github_actions/github-act…

Merge pull request #77 from smlx/dependabot/github_actions/github-act… #19

Workflow file for this run

name: release
on:
push:
branches:
- main
permissions: {}
jobs:
release-tag:
permissions:
# create tag
contents: write
runs-on: ubuntu-latest
outputs:
new-tag: ${{ steps.ccv.outputs.new-tag }}
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- name: Bump tag if necessary
id: ccv
uses: smlx/ccv@d3de774e9b607b079940a7a86952f44643743336 # v0.9.0
release-build:
permissions:
# create release
contents: write
# push docker images to registry
packages: write
# use OIDC token for signing
id-token: write
# required by attest-build-provenance
attestations: write
needs: release-tag
if: needs.release-tag.outputs.new-tag == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: stable
- name: Login to GHCR
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: advanced-security/sbom-generator-action@375dee8e6144d9fd0ec1f5667b4f6fb4faacefed # v0.0.1
id: sbom
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Move sbom to avoid dirty git
run: mv "$GITHUB_SBOM_PATH" ./sbom.spdx.json
env:
GITHUB_SBOM_PATH: ${{ steps.sbom.outputs.fileName }}
- uses: goreleaser/goreleaser-action@286f3b13b1b49da4ac219696163fb8c1c93e1200 # v6.0.0
id: goreleaser
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_SBOM_PATH: ./sbom.spdx.json
# attest archives
- uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-path: "dist/*.tar.gz"
# parse artifacts to the format required for image attestation
- run: |
echo "digest=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("sems_mitm_exporter:v"))|.extra.Digest')" >> "$GITHUB_OUTPUT"
echo "name=$(echo "$ARTIFACTS" | jq -r '.[]|select(.type=="Docker Manifest")|select(.name|test("sems_mitm_exporter:v"))|.name|split(":")[0]')" >> "$GITHUB_OUTPUT"
id: image_metadata_sems_mitm_exporter
env:
ARTIFACTS: ${{steps.goreleaser.outputs.artifacts}}
# attest images
- uses: actions/attest-build-provenance@bdd51370e0416ac948727f861e03c2f05d32d78e # v1.3.2
with:
subject-digest: ${{steps.image_metadata_sems_mitm_exporter.outputs.digest}}
subject-name: ${{steps.image_metadata_sems_mitm_exporter.outputs.name}}
push-to-registry: true