Skip to content

Commit c26d315

Browse files
authored
Adopt zizmor, GH actions improvements (#185)
1 parent e60c73e commit c26d315

14 files changed

Lines changed: 167 additions & 161 deletions

File tree

.github/actions/android/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,12 @@ runs:
3939
if: ${{ inputs.sign-publication == '1' }}
4040
run: |
4141
cd android
42-
./gradlew build zipPublication -PgpgKey=${{ inputs.gpg-key }} -PgpgPassword=${{ inputs.gpg-password }}
42+
./gradlew build zipPublication -PgpgKey=${INPUTS_GPG_KEY} -PgpgPassword=${INPUTS_GPG_PASSWORD}
4343
ls -lh build/outputs/aar
4444
find build/repository
45+
env:
46+
INPUTS_GPG_KEY: ${{ inputs.gpg-key }}
47+
INPUTS_GPG_PASSWORD: ${{ inputs.gpg-password }}
4548

4649
- name: Build library without signing
4750
shell: bash

.github/actions/linux/action.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ runs:
55
using: "composite"
66
steps:
77
- name: Install Rust Nightly
8-
uses: dtolnay/rust-toolchain@stable
9-
with:
10-
toolchain: nightly-2026-04-10
11-
components: rust-src
12-
targets: aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu,i686-unknown-linux-gnu,riscv64gc-unknown-linux-gnu,armv7-unknown-linux-gnueabihf
8+
shell: bash
9+
run:
10+
rustup install --target aarch64-unknown-linux-gnu,x86_64-unknown-linux-gnu,i686-unknown-linux-gnu,riscv64gc-unknown-linux-gnu,armv7-unknown-linux-gnueabihf
1311

1412
- name: Install cross-compiling GCC
1513
shell: bash

.github/actions/macos/action.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,9 @@ runs:
55
using: "composite"
66
steps:
77
- name: Install Rust Nightly
8-
uses: dtolnay/rust-toolchain@stable
9-
with:
10-
toolchain: nightly-2026-04-10
11-
components: rust-src
12-
targets: x86_64-apple-darwin,aarch64-apple-darwin
8+
shell: bash
9+
run:
10+
rustup install --target x86_64-apple-darwin,aarch64-apple-darwin
1311

1412
- name: Build binaries
1513
shell: bash

.github/actions/upload/action.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/actions/wasm/action.yml

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,8 @@ runs:
55
using: "composite"
66
steps:
77
- name: Install Rust Nightly
8-
uses: dtolnay/rust-toolchain@stable
9-
with:
10-
toolchain: nightly-2026-04-10
11-
components: rust-src
12-
13-
- name: Setup emsdk
14-
uses: mymindstorm/setup-emsdk@v14
15-
with:
16-
version: 4.0.10
8+
shell: bash
9+
run: rustup install
1710

1811
- name: Build WASM
1912
shell: bash
@@ -23,7 +16,4 @@ runs:
2316
with:
2417
name: wasm-library
2518
retention-days: 14
26-
path: |
27-
libpowersync-async.wasm
28-
libpowersync.wasm
29-
libpowersync-wasm.a
19+
path: libpowersync-wasm.a

.github/actions/windows/action.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,8 @@ runs:
55
using: "composite"
66
steps:
77
- name: Install Rust Nightly
8-
uses: dtolnay/rust-toolchain@stable
9-
with:
10-
toolchain: nightly-2026-04-10
11-
components: rust-src
12-
targets: x86_64-pc-windows-msvc,aarch64-pc-windows-msvc,i686-pc-windows-msvc
8+
shell: powershell
9+
run: rustup install --target x86_64-pc-windows-msvc,aarch64-pc-windows-msvc,i686-pc-windows-msvc
1310

1411
- name: Build binaries
1512
shell: bash

.github/actions/xcframework/action.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ runs:
1717
x86_64-apple-ios
1818
1919
- name: setup-cocoapods
20-
uses: maxim-lobanov/setup-cocoapods@v1
20+
uses: maxim-lobanov/setup-cocoapods@8e97e1e98e6ccf42564fdf5622c8feec74199377 # v1.4.0
2121
with:
2222
version: 1.16.2
2323

2424
- name: Set up XCode
25-
uses: maxim-lobanov/setup-xcode@v1
25+
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
2626
with:
2727
# TODO: Update to latest-stable once GH installs iOS 26 simulators
2828
xcode-version: '^16.4.0'

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: weekly
7+
cooldown:
8+
default-days: 7
9+
groups:
10+
github-actions:
11+
patterns:
12+
- "*"

.github/workflows/release.yml

Lines changed: 69 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -4,60 +4,74 @@ on:
44
tags:
55
- v[0-9]+.[0-9]+.[0-9]+
66

7+
permissions: {}
8+
79
jobs:
810
draft_release:
911
name: Create Draft GitHub Release
1012
runs-on: ubuntu-latest
1113
outputs:
1214
tag: ${{ steps.tag.outputs.tag }}
15+
permissions:
16+
contents: write # Needed to create a release
1317
steps:
14-
- uses: actions/checkout@v3
18+
- uses: actions/checkout@v6
1519
with:
20+
persist-credentials: false
1621
fetch-depth: 0
1722

1823
- name: Set tag name
1924
id: tag
2025
run: |
21-
tag=$(basename "${{ github.ref }}")
26+
tag=$(basename "${GITHUB_REF}")
2227
echo "tag=$tag" >> $GITHUB_OUTPUT
2328
- name: Create Release
2429
env:
2530
GH_TOKEN: ${{ github.token }}
2631
GH_REPO: ${{ github.repository }}
32+
STEPS_TAG_OUTPUTS_TAG: ${{ steps.tag.outputs.tag }}
2733
run: |
28-
tag="${{ steps.tag.outputs.tag }}"
34+
tag="${STEPS_TAG_OUTPUTS_TAG}"
2935
body="Release $tag"
3036
gh release create --draft "$tag" --title "$tag" --notes "$body"
3137
3238
libs_linux:
3339
name: Building Linux libraries
3440
runs-on: ubuntu-latest
3541
steps:
36-
- uses: actions/checkout@v4
42+
- uses: actions/checkout@v6
43+
with:
44+
persist-credentials: false
3745
- name: Build Linux
3846
uses: ./.github/actions/linux
3947

4048
libs_macos:
4149
name: Building macOS libraries
4250
runs-on: macos-latest
4351
steps:
44-
- uses: actions/checkout@v4
52+
- uses: actions/checkout@v6
53+
with:
54+
persist-credentials: false
4555
- name: Build macOS
4656
uses: ./.github/actions/macos
4757

4858
libs_windows:
4959
name: Building Windows libraries
5060
runs-on: windows-latest
5161
steps:
52-
- uses: actions/checkout@v4
62+
- uses: actions/checkout@v6
63+
with:
64+
persist-credentials: false
5365
- name: Build Windows
5466
uses: ./.github/actions/windows
5567

5668
libs_android:
5769
name: Building Android libraries
5870
runs-on: ubuntu-latest
5971
steps:
60-
- uses: actions/checkout@v4
72+
- uses: actions/checkout@v6
73+
with:
74+
persist-credentials: false
6175
- name: Build Android
6276
uses: ./.github/actions/android
6377
with:
@@ -68,7 +82,9 @@ jobs:
6882
name: Basic WASM build
6983
runs-on: ubuntu-latest
7084
steps:
71-
- uses: actions/checkout@v4
85+
- uses: actions/checkout@v6
86+
with:
87+
persist-credentials: false
7288

7389
- name: Build wasm
7490
uses: ./.github/actions/wasm
@@ -77,28 +93,31 @@ jobs:
7793
name: Build XCFramework
7894
runs-on: macos-latest
7995
steps:
80-
- uses: actions/checkout@v4
96+
- uses: actions/checkout@v6
97+
with:
98+
persist-credentials: false
8199
- name: Build XCFramework
82100
uses: ./.github/actions/xcframework
83101

84102
publish_android:
85-
permissions:
86-
contents: read
87-
packages: write
88103
name: Publish Android
89104
needs: [ draft_release, libs_android ]
90105
runs-on: ubuntu-latest
91106
steps:
92-
- uses: actions/checkout@v4
107+
- uses: actions/checkout@v6
108+
with:
109+
persist-credentials: false
93110

94111
- uses: actions/download-artifact@v4
95112
with:
96113
name: android-library
97114

98115
- name: Publish to Maven Central
116+
env:
117+
AUTH_TOKEN: ${{ secrets.CENTRAL_AUTH }}
99118
run: |
100119
curl --request POST \
101-
--header 'Authorization: Bearer ${{ secrets.CENTRAL_AUTH }}' \
120+
--header "Authorization: Bearer $AUTH_TOKEN" \
102121
--form bundle=@powersync_android.zip \
103122
'https://central.sonatype.com/api/v1/publisher/upload?publishingType=AUTOMATIC'
104123
@@ -107,7 +126,9 @@ jobs:
107126
needs: [ draft_release, libs_xcframework ]
108127
runs-on: macos-latest
109128
steps:
110-
- uses: actions/checkout@v4
129+
- uses: actions/checkout@v6
130+
with:
131+
persist-credentials: false
111132

112133
- name: Download libs
113134
uses: actions/download-artifact@v5
@@ -132,17 +153,21 @@ jobs:
132153
env:
133154
GH_TOKEN: ${{ github.token }}
134155
GH_REPO: ${{ github.repository }}
156+
NEEDS_DRAFT_RELEASE_OUTPUTS_TAG: ${{ needs.draft_release.outputs.tag }}
157+
STEPS_FILENAME_OUTPUTS_FILENAME: ${{ steps.fileName.outputs.fileName }}
135158
run: |
136-
gh release upload "${{ needs.draft_release.outputs.tag }}" ${{ steps.fileName.outputs.fileName }}
159+
gh release upload "${NEEDS_DRAFT_RELEASE_OUTPUTS_TAG}" ${STEPS_FILENAME_OUTPUTS_FILENAME}
137160
138161
# For SPM package
139162
- name: Generate and add checksum to output
140163
id: checksum
141164
run: |
142-
CHECKSUM=$(swift package compute-checksum ${{ steps.fileName.outputs.fileName }})
165+
CHECKSUM=$(swift package compute-checksum ${STEPS_FILENAME_OUTPUTS_FILENAME})
143166
echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT
167+
env:
168+
STEPS_FILENAME_OUTPUTS_FILENAME: ${{ steps.fileName.outputs.fileName }}
144169
- name: Dispatch release to SPM package
145-
uses: peter-evans/repository-dispatch@v3
170+
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0.1
146171
with:
147172
token: ${{ secrets.SWIFT_PUBLISH_TOKEN }}
148173
repository: powersync-ja/powersync-sqlite-core-swift
@@ -160,9 +185,13 @@ jobs:
160185
name: Publish Desktop libraries
161186
needs: [ draft_release, libs_linux, libs_macos, libs_windows ]
162187
runs-on: ubuntu-latest
188+
permissions:
189+
contents: write # Needed to upload binaries to release.
163190

164191
steps:
165-
- uses: actions/checkout@v4
192+
- uses: actions/checkout@v6
193+
with:
194+
persist-credentials: false
166195

167196
- name: Download Linux libraries
168197
uses: actions/download-artifact@v5
@@ -195,51 +224,45 @@ jobs:
195224
env:
196225
GH_TOKEN: ${{ github.token }}
197226
GH_REPO: ${{ github.repository }}
227+
TAG: ${{ needs.draft_release.outputs.tag }}
198228
run: |
199-
gh release upload "${{ needs.draft_release.outputs.tag }}" *.dll
200-
gh release upload "${{ needs.draft_release.outputs.tag }}" *.dylib
201-
gh release upload "${{ needs.draft_release.outputs.tag }}" *.so
202-
gh release upload "${{ needs.draft_release.outputs.tag }}" static_libs.zip
229+
gh release upload "${TAG}" *.dll
230+
gh release upload "${TAG}" *.dylib
231+
gh release upload "${TAG}" *.so
232+
gh release upload "${TAG}" static_libs.zip
203233
204234
publish_wasm:
205235
name: Publish WASM builds
206236
needs: [ draft_release, libs_wasm ]
207237
runs-on: ubuntu-latest
238+
permissions:
239+
contents: write # Needed to upload binaries to release.
208240
steps:
209-
- uses: actions/checkout@v4
241+
- uses: actions/checkout@v6
242+
with:
243+
persist-credentials: false
210244

211245
- name: Download wasm bundle
212246
uses: actions/download-artifact@v5
213247
with:
214248
name: wasm-library
215249

216-
- name: Upload libpowersync.wasm
217-
uses: ./.github/actions/upload
218-
with:
219-
repo-token: ${{ secrets.GITHUB_TOKEN }}
220-
file-name: libpowersync.wasm
221-
tag: ${{ needs.draft_release.outputs.tag }}
222-
223-
- name: Upload libpowersync-async.wasm
224-
uses: ./.github/actions/upload
225-
with:
226-
repo-token: ${{ secrets.GITHUB_TOKEN }}
227-
file-name: libpowersync-async.wasm
228-
tag: ${{ needs.draft_release.outputs.tag }}
229-
230-
- name: Upload libpowersync-wasm.a
231-
uses: ./.github/actions/upload
232-
with:
233-
repo-token: ${{ secrets.GITHUB_TOKEN }}
234-
file-name: libpowersync-wasm.a
235-
tag: ${{ needs.draft_release.outputs.tag }}
250+
- name: Upload wasm binaries
251+
env:
252+
GH_TOKEN: ${{ github.token }}
253+
GH_REPO: ${{ github.repository }}
254+
TAG: ${{ needs.draft_release.outputs.tag }}
255+
run: |
256+
gh release upload "${TAG}" libpowersync-wasm.a
236257
237258
publish_crates_io:
238259
runs-on: ubuntu-latest
239260
permissions:
240261
id-token: write # Required for OIDC token exchange
241262
steps:
242-
- uses: actions/checkout@v5
263+
- uses: actions/checkout@v6
264+
with:
265+
persist-credentials: false
243266
- uses: rust-lang/crates-io-auth-action@v1
244267
id: auth
245268

@@ -257,7 +280,7 @@ jobs:
257280
create_sdk_issue:
258281
name: "Create issue for SDK updates"
259282
permissions:
260-
issues: write
283+
issues: write # To create issue
261284
runs-on: macos-latest
262285
needs:
263286
- draft_release

0 commit comments

Comments
 (0)