diff --git a/.github/config-release.yml b/.github/config-release.yml index d14ac58..163e03c 100644 --- a/.github/config-release.yml +++ b/.github/config-release.yml @@ -14,4 +14,4 @@ binary: slsa-verifier-{{ .Os }}-{{ .Arch }} dir: ./cli/slsa-verifier ldflags: - - "-X version.Version={{ .Version }}" + - "-X version.Version={{ .Env.Version }}" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6442dd9..96d1d22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,6 +17,20 @@ env: ISSUE_REPOSITORY: slsa-framework/slsa-verifier jobs: + # Generate ldflags dynamically. + args: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.ldflags.outputs.version }} + steps: + - id: checkout + uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # tag=v2.3.4 + with: + fetch-depth: 0 + - id: ldflags + run: | + echo "::set-output name=version::$(git describe --tags --always --dirty | cut -c2-)" + builder: permissions: actions: read # For the detection of GitHub Actions environment. @@ -27,6 +41,7 @@ jobs: go-version: 1.18 config-file: .github/config-release.yml compile-builder: true + evaluated-envs: "VERSION:${{needs.args.outputs.version}}" # In case this fails, e.g. build configuration changes, file an issue in slsa-verifier if-failed: