Skip to content

Add SLSA builder to release binary, and -version/-help flags #3

Add SLSA builder to release binary, and -version/-help flags

Add SLSA builder to release binary, and -version/-help flags #3

name: SLSA go releaser
on:
pull_request:
jobs:
args:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.ldflags.outputs.version }}
commit: ${{ steps.ldflags.outputs.commit }}
commit-date: ${{ steps.ldflags.outputs.commit-date }}
tree-state: ${{ steps.ldflags.outputs.tree-state }}
steps:
- id: checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # tag=v4.1.6
with:
fetch-depth: 0
- id: ldflags
run: |
echo "version=$(git describe --tags --always --dirty | cut -c2-)" >> "$GITHUB_OUTPUT"
echo "commit=$GITHUB_SHA" >> "$GITHUB_OUTPUT"
echo "commit-date=$(git log --date=iso8601-strict -1 --pretty=%ct)" >> "$GITHUB_OUTPUT"
echo "tree-state=$(if git diff --quiet; then echo "clean"; else echo "dirty"; fi)" >> "$GITHUB_OUTPUT"
# build:
# permissions:
# id-token: write # To sign the provenance.
# contents: write # To upload assets to release.
# actions: read # To read the workflow path.
# strategy:
# matrix:
# os:
# - linux
# - darwin
# arch:
# - amd64
# - arm64
# exclude:
# - os: linux
# arch: arm64
# needs: args
# uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected]
# with:
# go-version: 1.21
# config-file: .github/workflows/.slsa-goreleaser/${{matrix.os}}-${{matrix.arch}}.yaml
# evaluated-envs: "VERSION:${{needs.args.outputs.version}}, COMMIT:${{needs.args.outputs.commit}}, COMMIT_DATE:${{needs.args.outputs.commit-date}}, TREE_STATE:${{needs.args.outputs.tree-state}}"