Skip to content

Commit dbce509

Browse files
committed
fix: improvements
Signed-off-by: Carlos Alexandro Becker <[email protected]>
1 parent 72620b0 commit dbce509

File tree

2 files changed

+33
-14
lines changed

2 files changed

+33
-14
lines changed

.goreleaser.yaml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ builds:
2121
# ensures mod timestamp to be the commit timestamp
2222
mod_timestamp: "{{ .CommitTimestamp }}"
2323
flags:
24-
# trims path
2524
- -trimpath
2625
ldflags:
2726
# use commit date instead of current date as main.date
@@ -42,6 +41,14 @@ checksum:
4241
# https://goreleaser.com/customization/source/
4342
source:
4443
enabled: true
44+
name_template: "{{ .ProjectName }}.src"
45+
46+
archives:
47+
- format: tar.gz
48+
wrap_in_directory: true
49+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
50+
builds_info:
51+
mtime: "{{ .CommitTimestamp }}"
4552

4653
# creates SBOMs of all archives and the source tarball using syft
4754
# https://goreleaser.com/customization/sbom
@@ -61,7 +68,7 @@ signs:
6168
- "--output-certificate=${certificate}"
6269
- "--output-signature=${signature}"
6370
- "${artifact}"
64-
- "--yes" # needed on cosign 2.0.0+
71+
- "--yes"
6572
artifacts: checksum
6673
output: true
6774

README.md

Lines changed: 24 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,35 +27,43 @@ It will:
2727

2828
## Verifying
2929

30+
```bash
31+
export VERSION="$(gh release list -L 1 -R goreleaser/example-secure --json=tagName -q '.[] | .tagName')"
32+
```
33+
3034
### Checksums
3135

3236
```shell
33-
wget https://github.com/goreleaser/example-secure/releases/download/v0.0.4/checksums.txt
37+
wget https://github.com/goreleaser/example-secure/releases/download/$VERSION/checksums.txt
3438
cosign verify-blob \
35-
--certificate-identity 'https://github.com/goreleaser/example-secure/.github/workflows/release.yml@refs/tags/v0.0.4' \
39+
--certificate-identity 'https://github.com/goreleaser/example-secure/.github/workflows/release.yml@refs/tags/$VERSION' \
3640
--certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \
37-
--cert https://github.com/goreleaser/example-secure/releases/download/v0.0.4/checksums.txt.pem \
38-
--signature https://github.com/goreleaser/example-secure/releases/download/v0.0.4/checksums.txt.sig \
41+
--cert https://github.com/goreleaser/example-secure/releases/download/$VERSION/checksums.txt.pem \
42+
--signature https://github.com/goreleaser/example-secure/releases/download/$VERSION/checksums.txt.sig \
3943
./checksums.txt
4044
```
4145

4246
You can then download any file you want from the release, and verify it with, for example:
4347

4448
```shell
45-
wget https://github.com/goreleaser/example-secure/releases/download/v0.0.4/example_0.0.4_linux_amd64.tar.gz
49+
wget https://github.com/goreleaser/example-secure/releases/download/$VERSION/example_linux_amd64.tar.gz
4650
sha256sum --ignore-missing -c checksums.txt
4751
```
4852

4953
And both should say "OK".
5054

5155
### SBOMs
5256

53-
You can then inspect the `.sbom` file to see the entire dependency tree of the binary, check for vulnerable dependencies and whatnot:
57+
You can then inspect the `.sbom` file to see the entire dependency tree of the
58+
binary, check for vulnerable dependencies and whatnot.
59+
60+
To get the SBOM of an artifact, you can use the same download URL, adding
61+
`.sbom.json` to the end of the URL:
5462

5563
```shell
56-
wget https://github.com/goreleaser/example-secure/releases/download/v0.0.4/example_0.0.4_linux_amd64.tar.gz.sbom.json
64+
wget https://github.com/goreleaser/example-secure/releases/download/$VERSION/example_linux_amd64.tar.gz.sbom.json
5765
sha256sum --ignore-missing -c checksums.txt
58-
grype sbom:example_0.0.4_linux_amd64.tar.gz.sbom.json
66+
grype sbom:example_linux_amd64.tar.gz.sbom.json
5967
```
6068

6169
### Attestations
@@ -64,20 +72,24 @@ This example also publishes build attestations.
6472
You can verify any artifact with:
6573

6674
```shell
67-
gh attestation verify --owner goreleaser *.tar.gz
75+
gh attestation verify \
76+
--owner goreleaser \
77+
*.tar.gz
6878
```
6979

7080
### Docker image
7181

7282
```shell
7383
cosign verify \
74-
--certificate-identity 'https://github.com/goreleaser/example-secure/.github/workflows/release.yml@refs/tags/v0.0.4' \
84+
--certificate-identity 'https://github.com/goreleaser/example-secure/.github/workflows/release.yml@refs/tags/$VERSION' \
7585
--certificate-oidc-issuer 'https://token.actions.githubusercontent.com' \
76-
ghcr.io/goreleaser/example-secure:v0.0.4
86+
ghcr.io/goreleaser/example-secure:$VERSION
7787
```
7888

7989
The images are also attested:
8090

8191
```shell
82-
gh attestation verify --owner goreleaser oci://ghcr.io/goreleaser/example-secure:v0.0.4
92+
gh attestation verify \
93+
--owner goreleaser \
94+
oci://ghcr.io/goreleaser/example-secure:$VERSION
8395
```

0 commit comments

Comments
 (0)