-
Notifications
You must be signed in to change notification settings - Fork 347
279 lines (246 loc) · 9.19 KB
/
release.yml
File metadata and controls
279 lines (246 loc) · 9.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Release
on:
push:
tags:
- 'v*'
workflow_dispatch:
inputs:
tag:
description: 'Release tag (e.g., v0.3.14)'
required: true
type: string
permissions:
contents: write
packages: write
id-token: write
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install cross-compilers
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf gcc-arm-linux-gnueabi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Install Syft for SBOM generation
uses: anchore/sbom-action/download-syft@v0
with:
syft-version: latest
- name: Import GPG key
if: ${{ env.GPG_PRIVATE_KEY != '' }}
id: import_gpg
uses: crazy-max/ghaction-import-gpg@v6
with:
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
vfs-build-linux:
name: Build VFS (Linux ${{ matrix.arch }})
runs-on: ubuntu-22.04 # glibc 2.35 (ubuntu-20.04 runners deprecated)
needs: goreleaser
strategy:
matrix:
arch: [amd64, arm64]
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Install cross-compiler (arm64)
if: matrix.arch == 'arm64'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Build VFS extension
run: make vfs-linux-${{ matrix.arch }}
- name: Verify artifact
run: |
file dist/litestream-vfs-linux-${{ matrix.arch }}.so
# For native arch, verify it can be loaded by SQLite
if [ "${{ matrix.arch }}" == "amd64" ]; then
sqlite3 ':memory:' ".load dist/litestream-vfs-linux-amd64.so" ".exit" && echo "Extension loads successfully"
fi
# For cross-compiled arch, verify ELF header and architecture
if [ "${{ matrix.arch }}" == "arm64" ]; then
readelf -h dist/litestream-vfs-linux-arm64.so | grep -E "(Class|Machine)"
echo "ARM64 ELF header verified"
fi
- name: Create archive
run: |
cd dist
cp litestream-vfs-linux-${{ matrix.arch }}.so litestream.so
tar -czvf litestream-vfs-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz \
litestream.so
- name: Generate checksum
run: |
cd dist
sha256sum litestream-vfs-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz \
> litestream-vfs-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz.sha256
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.version.outputs.version }} \
dist/litestream-vfs-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz \
dist/litestream-vfs-${{ steps.version.outputs.version }}-linux-${{ matrix.arch }}.tar.gz.sha256 \
--clobber
vfs-build-darwin:
name: Build VFS (macOS ${{ matrix.arch }})
runs-on: ${{ matrix.runner }}
needs: goreleaser
strategy:
matrix:
include:
- arch: amd64
runner: macos-15
- arch: arm64
runner: macos-15
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Get version
id: version
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
echo "version=${{ inputs.tag }}" >> $GITHUB_OUTPUT
else
echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
fi
- name: Build VFS extension
run: make vfs-darwin-${{ matrix.arch }}
- name: Verify artifact
run: |
file dist/litestream-vfs-darwin-${{ matrix.arch }}.dylib
# Verify architecture matches target
lipo -info dist/litestream-vfs-darwin-${{ matrix.arch }}.dylib
# Verify the expected symbol exists (macOS sqlite3 doesn't support .load)
nm -gU dist/litestream-vfs-darwin-${{ matrix.arch }}.dylib | grep sqlite3_litestreamvfs_init && echo "Entry point symbol found"
- name: Create archive
run: |
cd dist
cp litestream-vfs-darwin-${{ matrix.arch }}.dylib litestream.dylib
tar -czvf litestream-vfs-${{ steps.version.outputs.version }}-darwin-${{ matrix.arch }}.tar.gz \
litestream.dylib
- name: Generate checksum
run: |
cd dist
shasum -a 256 litestream-vfs-${{ steps.version.outputs.version }}-darwin-${{ matrix.arch }}.tar.gz \
> litestream-vfs-${{ steps.version.outputs.version }}-darwin-${{ matrix.arch }}.tar.gz.sha256
- name: Upload to release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release upload ${{ steps.version.outputs.version }} \
dist/litestream-vfs-${{ steps.version.outputs.version }}-darwin-${{ matrix.arch }}.tar.gz \
dist/litestream-vfs-${{ steps.version.outputs.version }}-darwin-${{ matrix.arch }}.tar.gz.sha256 \
--clobber
# macos-sign:
# runs-on: macos-latest
# needs: goreleaser
# strategy:
# matrix:
# arch: [amd64, arm64]
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# - name: Set up Go
# uses: actions/setup-go@v5
# with:
# go-version-file: go.mod
# - name: Download release artifacts
# uses: actions/download-artifact@v4
# with:
# name: litestream-darwin-${{ matrix.arch }}
# path: dist/
# - name: Import Apple Developer Certificate
# env:
# MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE_P12 }}
# MACOS_CERTIFICATE_PASSWORD: ${{ secrets.MACOS_CERTIFICATE_PASSWORD }}
# run: |
# echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
# security create-keychain -p actions temp.keychain
# security default-keychain -s temp.keychain
# security unlock-keychain -p actions temp.keychain
# security import certificate.p12 -k temp.keychain -P "$MACOS_CERTIFICATE_PASSWORD" -T /usr/bin/codesign
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k actions temp.keychain
# - name: Sign and Notarize
# env:
# APPLE_API_KEY: ${{ secrets.APPLE_API_KEY_P8 }}
# APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }}
# APPLE_API_ISSUER_ID: ${{ secrets.APPLE_API_ISSUER_ID }}
# AC_PASSWORD: ${{ secrets.AC_PASSWORD }}
# run: |
# gon etc/gon-${{ matrix.arch }}.hcl
# - name: Upload signed binary
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release upload ${{ github.ref_name }} dist/litestream-*-darwin-${{ matrix.arch }}.zip
# windows-sign:
# runs-on: windows-latest
# needs: goreleaser
# strategy:
# matrix:
# arch: [amd64, arm64]
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Download release artifacts
# uses: actions/download-artifact@v4
# with:
# name: litestream-windows-${{ matrix.arch }}
# path: dist/
#
# - name: Sign Windows binary
# env:
# WINDOWS_CERTIFICATE_PFX: ${{ secrets.WINDOWS_CERTIFICATE_PFX }}
# WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }}
# run: |
# echo "$env:WINDOWS_CERTIFICATE_PFX" | base64 -d > cert.pfx
# & signtool sign /f cert.pfx /p "$env:WINDOWS_CERTIFICATE_PASSWORD" /fd SHA256 /td SHA256 /tr http://timestamp.digicert.com dist\litestream.exe
# Remove-Item cert.pfx
#
# - name: Upload signed binary
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# run: |
# gh release upload ${{ github.ref_name }} dist\litestream-*-windows-${{ matrix.arch }}.zip