Skip to content

Commit

Permalink
Use cosign for releases
Browse files Browse the repository at this point in the history
  • Loading branch information
egibs committed Apr 24, 2024
1 parent 4220d4c commit b916b46
Show file tree
Hide file tree
Showing 5 changed files with 55 additions and 25 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version-file: '.go-version'
- name: go mod tidy
Expand Down
18 changes: 7 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,33 +7,29 @@ on:

permissions:
contents: write
id-token: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f
with:
fetch-depth: 0
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_KEY }}
passphrase: ${{ secrets.PASSPHRASE }}
- name: Install cosign
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 # v3.5.0
- name: Set up Go
uses: actions/setup-go@v4
uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version-file: '.go-version'
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v5
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
- name: Generate SBOM via Syft
uses: anchore/sbom-action@v0
uses: anchore/sbom-action@ab5d7b5f48981941c4c5d6bf33aeb98fe3bae38c
2 changes: 1 addition & 1 deletion .go-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.21.5
1.22.2
54 changes: 44 additions & 10 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,45 @@
project_name: deepwalk

before:
hooks:
- go mod download

env:
- COSIGN_YES=true

builds:
- id: deepwalk-build
binary: deepwalk
main: ./
env:
- CGO_ENABLED=0
goos:
- darwin
- linux
- windows
flags:
- -trimpath
mod_timestamp: '{{ .CommitTimestamp }}'
ldflags:
- -X main.BuildVersion={{.Version}}

signs:
- artifacts: checksum
cmd: gpg2
args:
- "--batch"
- "-u"
- "{{ .Env.GPG_FINGERPRINT }}"
- "--output"
- "${signature}"
- "--detach-sign"
- "${artifact}"
- id: deepwalk-cosign
cmd: cosign
certificate: "${artifact}.crt"
args: ["sign-blob", "--output-signature", "${signature}", "--output-certificate", "${certificate}", "${artifact}", "--yes"]
artifacts: all

archives:
- files:
- LICENSE
wrap_in_directory: true

checksum:
name_template: 'checksums.txt'

snapshot:
name_template: "{{ .Tag }}-next"

changelog:
sort: asc
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/egibs/deepwalk/v2

go 1.21
go 1.22

require (
github.com/spf13/cobra v1.8.0
Expand Down

0 comments on commit b916b46

Please sign in to comment.