@@ -10,8 +10,38 @@ permissions:
1010 packages : write
1111
1212jobs :
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
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"
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