3636 type : string
3737
3838permissions :
39- contents : write
39+ contents : read
4040
4141jobs :
4242 validate :
@@ -103,12 +103,20 @@ jobs:
103103 include :
104104 - runner : ubuntu-latest
105105 expected_file : libpaimon_c.linux.amd64.so.zst
106+ rust_target : x86_64-unknown-linux-gnu
107+ license_file : THIRD-PARTY-LICENSES.linux.amd64.html
106108 - runner : ubuntu-24.04-arm
107109 expected_file : libpaimon_c.linux.arm64.so.zst
110+ rust_target : aarch64-unknown-linux-gnu
111+ license_file : THIRD-PARTY-LICENSES.linux.arm64.html
108112 - runner : macos-15-intel
109113 expected_file : libpaimon_c.darwin.amd64.dylib.zst
114+ rust_target : x86_64-apple-darwin
115+ license_file : THIRD-PARTY-LICENSES.darwin.amd64.html
110116 - runner : macos-14
111117 expected_file : libpaimon_c.darwin.arm64.dylib.zst
118+ rust_target : aarch64-apple-darwin
119+ license_file : THIRD-PARTY-LICENSES.darwin.arm64.html
112120
113121 steps :
114122 - uses : actions/checkout@v7
@@ -120,6 +128,10 @@ jobs:
120128 rustup update stable
121129 rustup default stable
122130
131+ - uses : actions/setup-python@v6
132+ with :
133+ python-version : " 3.11"
134+
123135 - name : Cache Rust build outputs
124136 uses : actions/cache@v6
125137 with :
@@ -131,6 +143,11 @@ jobs:
131143 target/
132144 key : ${{ runner.os }}-${{ runner.arch }}-cargo-${{ hashFiles('**/Cargo.lock') }}
133145
146+ - name : Install cargo-about
147+ uses : taiki-e/install-action@a6b2e2dcd845ddd7f509ce4f3ed3d922b80cc5d9 # v2.84.0
148+ with :
149+ tool : cargo-about@0.9.1
150+
134151 - name : Install zstd on Linux
135152 if : runner.os == 'Linux'
136153 run : sudo apt-get update && sudo apt-get install -y zstd
@@ -143,48 +160,69 @@ jobs:
143160 working-directory : bindings/go
144161 run : make build
145162
146- - name : Verify packaged library
147- working-directory : bindings/go
163+ - name : Stage and verify packaged library
148164 shell : bash
149165 run : |
150- test -s '${{ matrix.expected_file }}'
166+ mkdir -p release/go
167+ cargo fetch --locked
168+ python3 scripts/release_licenses.py \
169+ --generate-go-report \
170+ '${{ matrix.rust_target }}' \
171+ release/go
172+ cp 'bindings/go/${{ matrix.expected_file }}' release/go/
173+ python3 scripts/verify_go_release_artifacts.py \
174+ --artifacts-dir release/go \
175+ --target '${{ matrix.rust_target }}'
151176
152177 - name : Upload packaged library
153178 uses : actions/upload-artifact@v7
154179 with :
155180 name : ${{ matrix.expected_file }}
156- path : bindings/go/${{ matrix.expected_file }}
181+ path : |
182+ release/go/${{ matrix.expected_file }}
183+ release/go/${{ matrix.license_file }}
157184 if-no-files-found : error
158185
159186 publish :
160187 needs :
161188 - validate
162189 - build
163190 runs-on : ubuntu-latest
191+ permissions :
192+ contents : write
164193 steps :
165194 - uses : actions/checkout@v7
166195 with :
167196 fetch-depth : 0
168197 ref : ${{ needs.validate.outputs.source_sha }}
169198
199+ - uses : actions/setup-python@v6
200+ with :
201+ python-version : " 3.11"
202+
203+ - name : Install cargo-about
204+ uses : taiki-e/install-action@a6b2e2dcd845ddd7f509ce4f3ed3d922b80cc5d9 # v2.84.0
205+ with :
206+ tool : cargo-about@0.9.1
207+
208+ - name : Fetch locked release inputs
209+ run : cargo fetch --locked
210+
211+ - name : Install artifact verification tools
212+ run : sudo apt-get update && sudo apt-get install -y file zstd
213+
170214 - name : Download packaged libraries
171215 uses : actions/download-artifact@v8
172216 with :
173- path : bindings /go
217+ path : release /go
174218 merge-multiple : true
175219
176- - name : Verify embedded assets
177- working-directory : bindings/go
220+ - name : Generate and verify release legal files
178221 shell : bash
179222 run : |
180- for file in \
181- libpaimon_c.linux.amd64.so.zst \
182- libpaimon_c.linux.arm64.so.zst \
183- libpaimon_c.darwin.amd64.dylib.zst \
184- libpaimon_c.darwin.arm64.dylib.zst
185- do
186- test -s "$file"
187- done
223+ python3 scripts/release_licenses.py \
224+ --generate-go-release release/go
225+ python3 scripts/verify_go_release_artifacts.py --artifacts-dir release/go
188226
189227 - name : Create release tag commit
190228 env :
@@ -197,7 +235,17 @@ jobs:
197235 git config user.name 'github-actions[bot]'
198236 git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
199237
200- git add bindings/go/libpaimon_c.*.zst
238+ cp release/go/libpaimon_c.*.zst bindings/go/
239+ cp \
240+ release/go/LICENSE \
241+ release/go/NOTICE \
242+ release/go/THIRD-PARTY-LICENSES.*.html \
243+ bindings/go/
244+ git add \
245+ bindings/go/libpaimon_c.*.zst \
246+ bindings/go/LICENSE \
247+ bindings/go/NOTICE \
248+ bindings/go/THIRD-PARTY-LICENSES.*.html
201249
202250 if ! git diff --cached --quiet; then
203251 git commit -m "bindings/go: release ${VERSION} (from ${SOURCE_REF}@${SOURCE_SHA})"
@@ -211,12 +259,18 @@ jobs:
211259 TAG : ${{ needs.validate.outputs.tag }}
212260 VERSION : ${{ needs.validate.outputs.version }}
213261 GH_TOKEN : ${{ github.token }}
214- working-directory : bindings /go
262+ working-directory : release /go
215263 run : |
216264 gh release create "$TAG" \
217265 --title "Release Go binding $VERSION" \
218266 --generate-notes \
267+ LICENSE \
268+ NOTICE \
219269 libpaimon_c.linux.amd64.so.zst \
220270 libpaimon_c.linux.arm64.so.zst \
221271 libpaimon_c.darwin.amd64.dylib.zst \
222- libpaimon_c.darwin.arm64.dylib.zst
272+ libpaimon_c.darwin.arm64.dylib.zst \
273+ THIRD-PARTY-LICENSES.linux.amd64.html \
274+ THIRD-PARTY-LICENSES.linux.arm64.html \
275+ THIRD-PARTY-LICENSES.darwin.amd64.html \
276+ THIRD-PARTY-LICENSES.darwin.arm64.html
0 commit comments