chore(deps): bump google.golang.org/protobuf from 1.35.1 to 1.35.2 in… #1423
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
name: Build, Test and Publish | |
on: | |
merge_group: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*' | |
pull_request: | |
workflow_dispatch: | |
permissions: | |
contents: read | |
env: | |
GO_VERSION: '>=1.21.3' | |
jobs: | |
lint: | |
name: Lints | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.5.4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
cache-dependency-path: './go.sum' | |
check-latest: true | |
go-version: ${{ env.GO_VERSION }} | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@971e284b6050e8a5849b72094c50ab08da042db8 # v6.1.1 | |
with: | |
version: latest | |
args: -v -c .golangci.yaml | |
audit: | |
name: Security Audits | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.5.4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
cache-dependency-path: './go.sum' | |
check-latest: true | |
go-version: ${{ env.GO_VERSION }} | |
- name: Run govulncheck | |
run: make audit | |
test: | |
name: Tests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.5.4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
cache-dependency-path: './go.sum' | |
check-latest: true | |
go-version: ${{ env.GO_VERSION }} | |
- name: Build | |
run: make build | |
- name: Run tests | |
run: make test | |
shellcheck: | |
name: Shellcheck | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 | |
- name: Run ShellCheck | |
uses: ludeeus/action-shellcheck@00cae500b08a931fb5698e11e79bfbd38e612a38 #2.0.0 | |
test-go-releaser: | |
name: Test Release Process | |
if: startsWith(github.ref, 'refs/tags/v') != true | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.5.4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
cache-dependency-path: './go.sum' | |
check-latest: true | |
go-version: ${{ env.GO_VERSION }} | |
- name: Extract Version from Tag | |
id: tag_name | |
run: | | |
echo "current_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.5.4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
cache-dependency-path: './go.sum' | |
check-latest: true | |
go-version: ${{ env.GO_VERSION }} | |
- uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7 | |
- name: Run GoReleaser | |
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 | |
with: | |
distribution: goreleaser | |
version: '~> v2' | |
args: release --clean --config .goreleaser.yaml --snapshot --skip sign,publish,announce | |
goreleaser: | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: [lint,audit,test,shellcheck] | |
permissions: | |
contents: write | |
packages: write # publish a new github release | |
id-token: write # needed for keyless signing | |
outputs: | |
digest: ${{ steps.image.outputs.digest }} | |
subjects-as-file: ${{ steps.hashes.outputs.handle }} | |
steps: | |
- name: Extract Version from Tag | |
id: tag_name | |
run: | | |
echo "current_version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Checkout | |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.5.4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Go | |
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0 | |
with: | |
cache-dependency-path: './go.sum' | |
check-latest: true | |
go-version: ${{ env.GO_VERSION }} | |
- name: Login to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 | |
- uses: anchore/sbom-action/download-syft@fc46e51fd3cb168ffb36c6d1915723c47db58abb # v0.17.7 | |
- name: Run GoReleaser | |
id: goreleaser | |
uses: goreleaser/goreleaser-action@9ed2f89a662bf1735a48bc8557fd212fa902bebf # v6.1.0 | |
with: | |
distribution: goreleaser | |
version: '~> v2' | |
args: release --clean --config .goreleaser.yaml | |
env: | |
GITHUB_TOKEN: ${{ secrets.GORELEASER_GITHUB_TOKEN }} | |
- name: Update Docker Hub Description | |
uses: peter-evans/dockerhub-description@e98e4d1628a5f3be2be7c231e50981aee98723ae # v4.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: openfga/cli | |
short-description: ${{ github.event.repository.description }} | |
- name: Generate binary hashes | |
id: binary | |
env: | |
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}" | |
run: | | |
set -euo pipefail | |
hashes=$(echo $ARTIFACTS | jq --raw-output '[.[] | {name, "digest": (.extra.Digest // .extra.Checksum)}] | unique | .[] | select(.digest) | {digest} + {name} | join(" ") | sub("^sha256:";"")' | base64 -w0) | |
echo $hashes > digests.txt | |
- uses: slsa-framework/slsa-github-generator/actions/generator/generic/create-base64-subjects-from-file@5a775b367a56d5bd118a224a811bba288150a563 # [email protected] | |
id: hashes | |
with: | |
path: digests.txt | |
- name: Image digest | |
id: image | |
env: | |
ARTIFACTS: "${{ steps.goreleaser.outputs.artifacts }}" | |
run: | | |
set -euo pipefail | |
artifact=$(echo "$ARTIFACTS" | jq -r '[.[] | select (.type=="Docker Manifest")][0]') | |
image=$(echo "$artifact" | jq -r '.path' | cut -d':' -f1) | |
digest=$(echo "$artifact" | jq -r '.extra.Digest') | |
echo "digest=$digest" >> "$GITHUB_OUTPUT" | |
binary-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. | |
# Note: this _must_ be referenced by tag. See: https://github.com/slsa-framework/slsa-verifier/issues/12 | |
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | |
with: | |
base64-subjects-as-file: "${{ needs.goreleaser.outputs.subjects-as-file }}" | |
provenance-name: "fga.intoto.jsonl" | |
upload-assets: true # upload to a new release | |
image-provenance: | |
needs: [ goreleaser ] | |
permissions: | |
actions: read | |
id-token: write | |
packages: write | |
# Note: this _must_ be referenced by tag. See: https://github.com/slsa-framework/slsa-verifier/issues/12 | |
uses: slsa-framework/slsa-github-generator/.github/workflows/[email protected] | |
with: | |
image: openfga/cli | |
digest: ${{ needs.goreleaser.outputs.digest }} | |
secrets: | |
registry-username: ${{ secrets.DOCKERHUB_USERNAME }} | |
registry-password: ${{ secrets.DOCKERHUB_TOKEN }} | |
verification-with-slsa-verifier: | |
needs: [ goreleaser, binary-provenance ] | |
runs-on: ubuntu-latest | |
permissions: read-all | |
steps: | |
- name: Install the verifier | |
uses: slsa-framework/slsa-verifier/actions/installer@3714a2a4684014deb874a0e737dffa0ee02dd647 # [email protected] | |
- name: Download assets | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
PROVENANCE: "${{ needs.binary-provenance.outputs.provenance-name }}" | |
run: | | |
set -euo pipefail | |
gh -R "$GITHUB_REPOSITORY" release download "$GITHUB_REF_NAME" \ | |
-p "$PROVENANCE" -p "*.tar.gz" -p "*.tar.gz.sbom.json" | |
- name: Verify assets | |
env: | |
PROVENANCE: "${{ needs.binary-provenance.outputs.provenance-name }}" | |
run: | | |
slsa-verifier verify-artifact \ | |
--provenance-path "$PROVENANCE" \ | |
--source-uri "github.com/$GITHUB_REPOSITORY" \ | |
--source-tag "$GITHUB_REF_NAME" \ | |
*.tar.gz *.tar.gz.sbom.json | |
verification-with-cosign: | |
needs: [ goreleaser, image-provenance ] | |
runs-on: ubuntu-latest | |
permissions: read-all | |
steps: | |
- name: Login to Docker Hub | |
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@dc72c7d5c4d10cd6bcb8cf6e3fd625a9e5e537da # v3.7.0 | |
- name: Verify image | |
env: | |
IMAGE: openfga/cli | |
DIGEST: ${{ needs.goreleaser.outputs.digest }} | |
run: | | |
cosign verify-attestation \ | |
--type slsaprovenance \ | |
--certificate-oidc-issuer https://token.actions.githubusercontent.com \ | |
--certificate-identity-regexp '^https://github.com/slsa-framework/slsa-github-generator/.github/workflows/generator_container_slsa3.yml@refs/tags/v[0-9]+.[0-9]+.[0-9]+$' \ | |
$IMAGE@$DIGEST |