99 default : ' libsql-0.9.4'
1010
1111jobs :
12+ extract-headers :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - name : Set libsql tag
16+ run : |
17+ TAG=${{ github.event.inputs.libsql_tag }}
18+ echo "Using tag: $TAG"
19+ echo "LIBSQL_TAG=$TAG" >> $GITHUB_ENV
20+
21+ - name : Checkout libsql at tag
22+ uses : actions/checkout@v4
23+ with :
24+ repository : tursodatabase/libsql
25+ ref : ${{ env.LIBSQL_TAG }}
26+ path : libsql
27+
28+ - name : Extract headers
29+ run : |
30+ mkdir -p include
31+ cp libsql/bindings/c/include/libsql.h include/
32+
33+ - name : Upload header artifact
34+ uses : actions/upload-artifact@v4
35+ with :
36+ name : libsql-headers
37+ path : include/
38+
1239 build-linux :
1340 runs-on : ubuntu-latest
1441 strategy :
@@ -114,7 +141,7 @@ jobs:
114141 path : go-libsql/lib/darwin_arm64
115142
116143 verify-linux-amd64 :
117- needs : [build-linux]
144+ needs : [build-linux, extract-headers ]
118145 runs-on : ubuntu-latest
119146 steps :
120147 - name : Checkout go-libsql
@@ -126,10 +153,18 @@ jobs:
126153 name : libsql-linux_amd64
127154 path : lib/linux_amd64
128155
156+ - name : Download headers
157+ uses : actions/download-artifact@v4
158+ with :
159+ name : libsql-headers
160+ path : lib/include
161+
129162 - name : Check binary details
130163 run : |
131164 echo "Linux AMD64 library size:"
132165 ls -la lib/linux_amd64/libsql_experimental.a
166+ echo "Header file:"
167+ ls -la lib/include/libsql.h
133168
134169 - name : Set up Go
135170 uses : actions/setup-go@v4
@@ -144,7 +179,7 @@ jobs:
144179 echo "Linux AMD64 build successful!"
145180
146181 verify-linux-arm64 :
147- needs : [build-linux]
182+ needs : [build-linux, extract-headers ]
148183 runs-on : ubuntu-latest
149184 steps :
150185 - name : Checkout go-libsql
@@ -156,10 +191,18 @@ jobs:
156191 name : libsql-linux_arm64
157192 path : lib/linux_arm64
158193
194+ - name : Download headers
195+ uses : actions/download-artifact@v4
196+ with :
197+ name : libsql-headers
198+ path : lib/include
199+
159200 - name : Check binary details
160201 run : |
161202 echo "Linux ARM64 library size:"
162203 ls -la lib/linux_arm64/libsql_experimental.a
204+ echo "Header file:"
205+ ls -la lib/include/libsql.h
163206
164207 - name : Set up Go
165208 uses : actions/setup-go@v4
@@ -179,7 +222,7 @@ jobs:
179222 echo "Linux ARM64 build successful!"
180223
181224 verify-darwin-arm64 :
182- needs : [build-macos]
225+ needs : [build-macos, extract-headers ]
183226 runs-on : macos-latest
184227 steps :
185228 - name : Checkout go-libsql
@@ -191,10 +234,18 @@ jobs:
191234 name : libsql-darwin_arm64
192235 path : lib/darwin_arm64
193236
237+ - name : Download headers
238+ uses : actions/download-artifact@v4
239+ with :
240+ name : libsql-headers
241+ path : lib/include
242+
194243 - name : Check binary details
195244 run : |
196245 echo "Darwin ARM64 library size:"
197246 ls -la lib/darwin_arm64/libsql_experimental.a
247+ echo "Header file:"
248+ ls -la lib/include/libsql.h
198249
199250 - name : Set up Go
200251 uses : actions/setup-go@v4
@@ -223,10 +274,19 @@ jobs:
223274
224275 - name : Copy artifacts to repository
225276 run : |
226- mkdir -p lib/linux_amd64 lib/linux_arm64 lib/darwin_arm64
277+ mkdir -p lib/linux_amd64 lib/linux_arm64 lib/darwin_arm64 lib/include
227278 cp -r artifacts/libsql-linux_amd64/* lib/linux_amd64/
228279 cp -r artifacts/libsql-linux_arm64/* lib/linux_arm64/
229280 cp -r artifacts/libsql-darwin_arm64/* lib/darwin_arm64/
281+
282+ # only copy header if it changed
283+ if ! cmp -s artifacts/libsql-headers/libsql.h lib/include/libsql.h 2>/dev/null; then
284+ cp artifacts/libsql-headers/libsql.h lib/include/
285+ echo "Header file updated"
286+ else
287+ echo "Header file unchanged, skipping"
288+ fi
289+
230290 # Clean up artifacts directory to prevent it from being included in the PR
231291 rm -rf artifacts
232292
@@ -248,6 +308,7 @@ jobs:
248308 - `linux_amd64/libsql_experimental.a`
249309 - `linux_arm64/libsql_experimental.a`
250310 - `darwin_arm64/libsql_experimental.a`
311+ - `include/libsql.h` (if changed)
251312
252313 This update was generated automatically by the [update-libsql workflow](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}).
253314 branch : update-${{ env.LIBSQL_TAG }}
0 commit comments