Skip to content

Commit 760f937

Browse files
committed
make reproducibility mandatory
1 parent 3494cbb commit 760f937

File tree

2 files changed

+61
-45
lines changed

2 files changed

+61
-45
lines changed

.github/workflows/checks.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,33 @@ jobs:
8080
go mod tidy
8181
git update-index -q --really-refresh
8282
git diff-index HEAD
83+
84+
reproducibility-test:
85+
name: Test Reproducible Builds
86+
runs-on: ubuntu-latest
87+
steps:
88+
- name: Checkout
89+
uses: actions/checkout@v4
90+
with:
91+
fetch-depth: 0
92+
93+
- name: Set up Go
94+
uses: actions/setup-go@v5
95+
with:
96+
go-version: '1.24'
97+
cache: true
98+
99+
- name: Set SOURCE_DATE_EPOCH for reproducible builds
100+
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)" >> $GITHUB_ENV
101+
102+
- name: Test reproducible builds
103+
run: |
104+
# Install GoReleaser
105+
go install github.com/goreleaser/goreleaser/v2@latest
106+
107+
# Run reproducibility test
108+
make package-test-reproducible
109+
110+
echo "✅ Reproducibility test passed"
111+
env:
112+
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}

.github/workflows/release.yaml

Lines changed: 31 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,38 @@ permissions:
1010
packages: write
1111

1212
jobs:
13+
reproducibility-test:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout
17+
uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up Go
22+
uses: actions/setup-go@v5
23+
with:
24+
go-version: '1.24'
25+
cache: true
26+
27+
- name: Set SOURCE_DATE_EPOCH for reproducible builds
28+
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)" >> $GITHUB_ENV
29+
30+
- name: Test reproducible builds
31+
run: |
32+
# Install GoReleaser
33+
go install github.com/goreleaser/goreleaser/v2@latest
34+
35+
# Run reproducibility test
36+
make package-test-reproducible
37+
38+
echo "✅ Reproducibility test passed"
39+
env:
40+
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}
41+
1342
release:
1443
runs-on: ubuntu-latest
44+
needs: reproducibility-test # Only run if reproducibility test passes
1545
steps:
1646
- name: Checkout
1747
uses: actions/checkout@v4
@@ -46,7 +76,7 @@ jobs:
4676

4777
- name: Run GoReleaser (Release)
4878
uses: goreleaser/goreleaser-action@v6
49-
if: startsWith(github.ref, 'refs/tags/') && !inputs.snapshot
79+
if: startsWith(github.ref, 'refs/tags/')
5080
with:
5181
distribution: goreleaser
5282
version: "~> v2"
@@ -57,19 +87,6 @@ jobs:
5787
GPG_KEY_PATH: ${{ steps.import_gpg.outputs.keyid && format('/tmp/gpg-{0}.key', steps.import_gpg.outputs.keyid) || '' }}
5888
NFPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
5989

60-
- name: Run GoReleaser (Snapshot)
61-
uses: goreleaser/goreleaser-action@v6
62-
if: inputs.snapshot || (!startsWith(github.ref, 'refs/tags/'))
63-
with:
64-
distribution: goreleaser
65-
version: "~> v2"
66-
args: release --snapshot --clean
67-
env:
68-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69-
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}
70-
GPG_KEY_PATH: ${{ steps.import_gpg.outputs.keyid && format('/tmp/gpg-{0}.key', steps.import_gpg.outputs.keyid) || '' }}
71-
NFPM_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
72-
7390
- name: Upload artifacts
7491
uses: actions/upload-artifact@v4
7592
with:
@@ -102,34 +119,3 @@ jobs:
102119
echo "❌ No AMD64 .deb file found for testing"
103120
exit 1
104121
fi
105-
106-
reproducibility-test:
107-
runs-on: ubuntu-latest
108-
needs: release
109-
if: always()
110-
steps:
111-
- name: Checkout
112-
uses: actions/checkout@v4
113-
with:
114-
fetch-depth: 0
115-
116-
- name: Set up Go
117-
uses: actions/setup-go@v5
118-
with:
119-
go-version: '1.24'
120-
cache: true
121-
122-
- name: Set SOURCE_DATE_EPOCH for reproducible builds
123-
run: echo "SOURCE_DATE_EPOCH=$(git log -1 --format=%ct)" >> $GITHUB_ENV
124-
125-
- name: Test reproducible builds
126-
run: |
127-
# Install GoReleaser
128-
go install github.com/goreleaser/goreleaser/v2@latest
129-
130-
# Run reproducibility test
131-
make package-test-reproducible
132-
133-
echo "✅ Reproducibility test passed"
134-
env:
135-
SOURCE_DATE_EPOCH: ${{ env.SOURCE_DATE_EPOCH }}

0 commit comments

Comments
 (0)