Skip to content

Commit dabdb6e

Browse files
committed
Use goreleaser to release new version
Cosign will now be used to sign the artifacts using the keyless mode.
1 parent f42b44e commit dabdb6e

File tree

8 files changed

+114
-73
lines changed

8 files changed

+114
-73
lines changed

.github/workflows/CI.yml

+8-6
Original file line numberDiff line numberDiff line change
@@ -41,16 +41,18 @@ jobs:
4141
run: go run honnef.co/go/tools/cmd/staticcheck -checks 'all,-ST1000' ./...
4242
- name: Gosec
4343
run: go run github.com/securego/gosec/cmd/gosec -exclude=G104 ./...
44-
build_script:
44+
test_release:
4545
runs-on: ubuntu-22.04
46-
name: Build across all supported architectures
46+
permissions:
47+
id-token: write
48+
contents: read
49+
name: Test release
4750
steps:
4851
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
4952
- uses: cachix/install-nix-action@4b933aa7ebcc94a6174cf1364864e957b4910265
50-
- name: Build
51-
run: ./scripts/build.sh
53+
- run: nix-shell --run 'goreleaser --snapshot --clean'
5254
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce
5355
with:
54-
name: pre-built-binaries
55-
path: pkg/*.zip
56+
name: test-release-dist
57+
path: dist/**/*
5658
retention-days: 2

.github/workflows/Release.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release
2+
3+
permissions: read-all
4+
5+
on:
6+
push:
7+
tags:
8+
- '*'
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-22.04
13+
permissions:
14+
id-token: write
15+
contents: write
16+
name: Test release
17+
steps:
18+
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9
19+
with:
20+
fetch-depth: 0
21+
- run: git fetch --force --tags
22+
- uses: cachix/install-nix-action@4b933aa7ebcc94a6174cf1364864e957b4910265
23+
- run: nix-shell --run 'goreleaser --clean'

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea
2-
pkg/
2+
pkg/
3+
dist/

.goreleaser.yaml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
gomod:
2+
proxy: true
3+
4+
report_sizes: true
5+
6+
builds:
7+
- env:
8+
- CGO_ENABLED=0
9+
goos:
10+
- darwin
11+
- windows
12+
- linux
13+
- freebsd
14+
- netbsd
15+
- openbsd
16+
- solaris
17+
goarch:
18+
- "386"
19+
- amd64
20+
- arm
21+
- arm64
22+
mod_timestamp: "{{ .CommitTimestamp }}"
23+
flags:
24+
- -trimpath
25+
ldflags:
26+
- -s -w -X github.com/LeSuisse/vault-gpg-plugin/version.GitCommit={{.Commit}}
27+
hooks:
28+
post:
29+
- cmd: sh -c 'sha256sum "{{ base .Path }}" > "{{ base .Path }}".sha256sum'
30+
dir: "{{ dir .Path }}"
31+
sboms:
32+
- artifacts: binary
33+
archives:
34+
- format: zip
35+
name_template: "{{ .Os }}_{{ .Arch }}"
36+
files:
37+
- README.md
38+
- LICENSE
39+
- docs/*
40+
- src: "{{ .ArtifactPath }}.sha256sum"
41+
dst: /
42+
strip_parent: true
43+
checksum:
44+
name_template: 'checksums.txt'
45+
signs:
46+
- id: binary-keyless
47+
signature: "${artifact}.bundle"
48+
cmd: cosign
49+
args: ["sign-blob", "--bundle", "${signature}", "--yes", "${artifact}"]
50+
artifacts: binary
51+
- id: checksum-keyless
52+
signature: "${artifact}.bundle"
53+
cmd: cosign
54+
args: ["sign-blob", "--bundle", "${signature}", "--yes", "${artifact}"]
55+
artifacts: checksum
56+
- id: sbom-keyless
57+
signature: "${artifact}.bundle"
58+
cmd: cosign
59+
args: ["sign-blob", "--bundle", "${signature}", "--yes", "${artifact}"]
60+
artifacts: sbom
61+
- id: packages-keyless
62+
signature: "${artifact}.bundle"
63+
cmd: cosign
64+
args: ["sign-blob", "--bundle", "${signature}", "--yes", "${artifact}"]
65+
artifacts: package
66+
snapshot:
67+
name_template: "{{ incpatch .Version }}-next"
68+
release:
69+
draft: true

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,13 @@ on the official Vault website. You can download and decompress the pre-compiled
2020
from the [latest release on GitHub](https://github.com/LeSuisse/vault-gpg-plugin/releases). SHA256 checksum for the
2121
pre-compiled plugin binary is also provided in the archive so it can be registered to your Vault plugin catalog.
2222

23-
All archives available from the [release tab on GitHub](https://github.com/LeSuisse/vault-gpg-plugin/releases) come with
24-
a GPG signature made with the GPG key [`FFCB D29F 3AFE D453 AE4B 9E32 1D40 FBA2 9EB3 9616`](https://sks-keyservers.net/pks/lookup?op=get&search=0xFFCBD29F3AFED453AE4B9E321D40FBA29EB39616).
23+
All archives available from the [release tab on GitHub](https://github.com/LeSuisse/vault-gpg-plugin/releases).
24+
All archives are signed using [Cosign](https://docs.sigstore.dev/cosign/verify/):
25+
26+
```
27+
$ cosign verify-blob <file> --bundle <file>.bundle \
28+
--certificate-oidc-issuer='https://token.actions.githubusercontent.com' \
29+
--certificate-identity-regexp='https://github.com/LeSuisse/vault-gpg-plugin/\.github/workflows/Release\.yml'
30+
```
2531

2632
Once mounted in Vault, this plugin exposes [this HTTP API](docs/http-api.md).

scripts/build.sh

-47
This file was deleted.

scripts/sign.sh

-12
This file was deleted.

shell.nix

+4-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@
77

88
pkgs.mkShell {
99
buildInputs = [
10-
pkgs.findutils
11-
pkgs.gitMinimal
12-
pkgs.zip
1310
pkgs.go_1_20
14-
pkgs.gnupg
15-
pkgs.rekor-cli
11+
pkgs.gitMinimal
12+
pkgs.goreleaser
13+
pkgs.syft
14+
pkgs.cosign
1615
];
1716
}

0 commit comments

Comments
 (0)