Skip to content

Commit af73f63

Browse files
author
DominicGBauer
committed
feat: add spm to deployment
1 parent aa09d5d commit af73f63

File tree

5 files changed

+50
-4
lines changed

5 files changed

+50
-4
lines changed

.github/workflows/ios.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828

2929
- name: Build iOS & macOS xcframework
3030
run: |
31-
./build-pod.sh
31+
./tool/build_xcframework.sh
3232
3333
- name: Lint pod
3434
run: |

.github/workflows/release.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ jobs:
7373
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
7474
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
7575

76-
publish_ios_pod:
76+
publish_ios_pod_and_spm_package:
7777
name: Publish iOS
7878
needs: [draft_release]
7979
runs-on: macos-latest
@@ -100,7 +100,7 @@ jobs:
100100

101101
- name: Build iOS & macOS xcframework
102102
run: |
103-
./build-pod.sh
103+
.tool/build_xcframework.sh
104104
105105
- name: Lint pod
106106
run: |
@@ -112,6 +112,26 @@ jobs:
112112
GH_REPO: ${{ github.repository }}
113113
run: |
114114
gh release upload "${{ needs.draft_release.outputs.tag }}" powersync-sqlite-core.xcframework.tar.xz
115+
gh release upload "${{ needs.draft_release.outputs.tag }}" powersync-sqlite-core.xcframework.tar.gz
116+
117+
# For SPM package
118+
- name: Compute checksum and update Package.swift
119+
run: |
120+
CHECKSUM=$(swift package compute-checksum powersync-sqlite-core.xcframework.tar.gz)
121+
sed -i '' \
122+
-e "s|url: \".*\"|url: \"https://github.com/${{ github.repository }}/releases/download/${{ needs.draft_release.outputs.tag }}/powersync-sqlite-core.xcframework.tar.gz\"|" \
123+
-e "s|checksum: \".*\"|checksum: \"$CHECKSUM\"|" \
124+
Package.swift
125+
126+
- name: Commit and push updated Package.swift
127+
run: |
128+
git config user.name github-actions
129+
git config user.email [email protected]
130+
git add Package.swift
131+
git commit -m "Update Package.swift for version ${{ needs.draft_release.outputs.tag }}"
132+
git push
133+
134+
115135
116136
publish_linux_x86_64:
117137
name: Publish Linux x86_64

Package.swift

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// swift-tools-version:5.3
2+
import PackageDescription
3+
let packageName = "PowerSyncSQLiteCore"
4+
5+
let package = Package(
6+
name: packageName,
7+
platforms: [
8+
.iOS(.v11),
9+
.macOS(.v10_13)
10+
],
11+
products: [
12+
.library(
13+
name: packageName,
14+
targets: [packageName]
15+
),
16+
],
17+
targets: [
18+
.binaryTarget(
19+
name: packageName,
20+
url: "https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v0.3.0/powersync-sqlite-core.xcframework.tar.gz",
21+
checksum: "65e09557520aabadfd5897c59a7b5e542f85a6c161b546dcb58109f63e0478e7"
22+
)
23+
]
24+
)

RELEASING.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Bump the version number in these places:
66
2. powersync-sqlite-core.podspec.
77
3. android/build.gradle.kts
88
4. android/src/prefab/prefab.json
9-
5. build-pod.sh - CFBundleVersion and CFBundleShortVersionString.
9+
5. tool/build_xcframework.sh - CFBundleVersion and CFBundleShortVersionString.
1010
6. `cargo build` to update Cargo.lock
1111

1212
Create a tag:

build-pod.sh renamed to tool/build_xcframework.sh

+2
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ EOF
6464

6565
cp -Rf "${BUILD_DIR}/powersync-sqlite-core.xcframework" "powersync-sqlite-core.xcframework"
6666
tar -cJvf powersync-sqlite-core.xcframework.tar.xz powersync-sqlite-core.xcframework LICENSE README.md
67+
# swift command used for checksum required for SPM package does not support xz so need to create a tar.gz
68+
tar -cJvf powersync-sqlite-core.xcframework.tar.gz powersync-sqlite-core.xcframework LICENSE README.md
6769
rm -rf ${BUILD_DIR}
6870
}
6971

0 commit comments

Comments
 (0)