Skip to content

Commit 3b4aefe

Browse files
authored
Add release workflow and config (#238)
Signed-off-by: Adolfo García Veytia (Puerco) <[email protected]>
1 parent 12e0d48 commit 3b4aefe

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

.github/workflows/release.yaml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
release:
12+
runs-on: ubuntu-latest
13+
14+
permissions:
15+
id-token: write # To sign attestations
16+
attestations: write # To push build provenance to attestations store
17+
contents: write # To create the release
18+
19+
steps:
20+
21+
- name: Setup bnd
22+
uses: carabiner-dev/actions/install/bnd@HEAD
23+
24+
- name: Check out code
25+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
26+
with:
27+
persist-credentials: false
28+
fetch-depth: 1
29+
30+
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.0
31+
with:
32+
go-version-file: sourcetool/go.mod
33+
cache: false
34+
35+
- name: Install tejolote
36+
uses: kubernetes-sigs/release-actions/setup-tejolote@a30d93cf2aa029e1e4c8a6c79f766aebf429fddb # v0.3.1
37+
with:
38+
tejolote-release: "0.4.1"
39+
40+
- name: Set tag output
41+
id: tag
42+
run: echo "tag_name=${GITHUB_REF#refs/*/}" >> "$GITHUB_OUTPUT"
43+
44+
- name: Run GoReleaser
45+
uses: goreleaser/goreleaser-action@9c156ee8a17a598857849441385a2041ef570552 # v6.3.0
46+
id: goreleaser
47+
with:
48+
args: release --clean
49+
env:
50+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51+
52+
- name: Generate Provenance
53+
id: tejolote
54+
env:
55+
GH_TOKEN: ${{ github.token }}
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57+
run: |
58+
mkdir attestations
59+
tejolote attest --artifacts github://${{github.repository}}/${{ steps.tag.outputs.tag_name }} github://${{github.repository}}/"${GITHUB_RUN_ID}" --output attestations/provenance.json
60+
# Remove this once tejolote attests fine
61+
sed -i 's|https://github.com/Attestations/GitHubActionsWorkflow@v1|https://actions.github.io/buildtypes/workflow/v1|' attestations/provenance.json
62+
bnd statement attestations/provenance.json -o attestations/sourcetool-${{ steps.tag.outputs.tag_name }}.provenance.json
63+
rm attestations/provenance.json
64+
bnd pack attestations/ > sourcetool.intoto.jsonl
65+
gh release upload ${{ steps.tag.outputs.tag_name }} sourcetool.intoto.jsonl
66+
# Remove this once GitHub like the tejolote build predicate
67+
# bnd push github ${{github.repository}} attestations/sourcetool-${{ steps.tag.outputs.tag_name }}.provenance.json
68+

.goreleaser.yaml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
project_name: sourcetool
3+
version: 2
4+
5+
env:
6+
- GO111MODULE=on
7+
- CGO_ENABLED=0
8+
9+
before:
10+
hooks:
11+
- /bin/bash -c 'cd sourcetool && go mod tidy'
12+
- /bin/bash -c 'if [ -n "$(git --no-pager diff --exit-code go.mod go.sum)" ]; then exit 1; fi'
13+
14+
gomod:
15+
proxy: false
16+
17+
builds:
18+
- id: release
19+
no_unique_dist_dir: true
20+
binary: sourcetool-{{ .Tag }}-{{ .Os }}-{{ .Arch }}
21+
main: ./sourcetool/
22+
goos:
23+
- darwin
24+
- linux
25+
- windows
26+
goarch:
27+
- amd64
28+
- arm64
29+
ignore:
30+
- goos: windows
31+
goarch: arm64
32+
- goos: darwin
33+
goarch: amd64
34+
flags:
35+
- -trimpath
36+
37+
archives:
38+
- formats: binary
39+
name_template: sourcetool-{{ .Tag }}-{{ .Os }}-{{ .Arch }}
40+
allow_different_binary_count: true
41+
checksum:
42+
disable: true
43+
44+
release:
45+
prerelease: auto
46+
47+
changelog:
48+
disable: false

0 commit comments

Comments
 (0)