🌱 Bump cloud.google.com/go/pubsub from 1.37.0 to 1.38.0 (#4088) #52
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
# Copyright 2021 OpenSSF Scorecard Authors | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
name: goreleaser | |
on: | |
push: | |
tags: | |
- "*" # triggers only if push new tag version, like `0.8.4` or else | |
permissions: | |
contents: read | |
env: | |
GO_VERSION: 1.22 | |
jobs: | |
goreleaser: | |
outputs: | |
hashes: ${{ steps.hash.outputs.hashes }} | |
permissions: | |
contents: write # for goreleaser/goreleaser-action to create a GitHub release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@a4aa98b93cab29d9b1101a6143fb8bce00e2eac4 # v1 | |
with: | |
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs | |
- name: Checkout | |
uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v2.2.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
check-latest: true | |
- name: Configure ldflags | |
id: ldflags | |
run: echo "version_flags=$(./scripts/version-ldflags)" >> "$GITHUB_OUTPUT" | |
- name: Run GoReleaser | |
id: run-goreleaser | |
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v2.5.0 | |
with: | |
version: latest | |
args: release --rm-dist | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
VERSION_LDFLAGS: ${{ steps.ldflags.outputs.version_flags }} | |
- name: Generate subject | |
id: hash | |
env: | |
ARTIFACTS: "${{ steps.run-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" | |
provenance: | |
needs: [goreleaser] | |
permissions: | |
actions: read # To read the workflow path. | |
id-token: write # To sign the provenance. | |
contents: write # To add assets to a release. | |
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | |
with: | |
base64-subjects: "${{ needs.goreleaser.outputs.hashes }}" | |
upload-assets: true # upload to a new release | |
verification: | |
needs: [goreleaser, provenance] | |
runs-on: ubuntu-latest | |
permissions: read-all | |
steps: | |
- name: Install the verifier | |
uses: slsa-framework/slsa-verifier/actions/[email protected] | |
- name: Download assets | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PROVENANCE: "${{ needs.provenance.outputs.provenance-name }}" | |
run: | | |
set -euo pipefail | |
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "*.tar.gz" | |
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" -p "$PROVENANCE" | |
- name: Verify assets | |
env: | |
CHECKSUMS: ${{ needs.goreleaser.outputs.hashes }} | |
PROVENANCE: "${{ needs.provenance.outputs.provenance-name }}" | |
run: | | |
set -euo pipefail | |
checksums=$(echo "$CHECKSUMS" | base64 -d) | |
while read -r line; do | |
fn=$(echo $line | cut -d ' ' -f2) | |
echo "Verifying $fn" | |
slsa-verifier verify-artifact --provenance-path "$PROVENANCE" \ | |
--source-uri "github.com/$GITHUB_REPOSITORY" \ | |
--source-tag "$GITHUB_REF_NAME" \ | |
"$fn" | |
done <<<"$checksums" |