Skip to content

Commit

Permalink
feat: add spm to deployment (#36)
Browse files Browse the repository at this point in the history
* feat: add spm to deployment

* chore: add test workflow to confirm everything works

* chore: change action to run on push

* chore: use macos 15 in action

* Update Package.swift for version 0.3.0

* chore: change to zip and revert to macos-latest

* Update Package.swift for version 0.3.0

* chore: pr reverts

* chore: update name

* chore: remove tar.xz

---------

Co-authored-by: DominicGBauer <[email protected]>
Co-authored-by: github-actions <[email protected]>
  • Loading branch information
3 people authored Oct 14, 2024
1 parent e3dad14 commit 1a77b9f
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:

- name: Build iOS & macOS xcframework
run: |
./build-pod.sh
./tool/build_xcframework.sh
- name: Lint pod
run: |
Expand Down
34 changes: 31 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}

publish_ios_pod:
publish_ios_pod_and_spm_package:
name: Publish iOS
needs: [draft_release]
runs-on: macos-latest
Expand All @@ -100,18 +100,46 @@ jobs:

- name: Build iOS & macOS xcframework
run: |
./build-pod.sh
.tool/build_xcframework.sh
- name: Lint pod
run: |
pod lib lint
# For SPM package
- name: Set xcFramework file name used for SPM package
id: fileName
run: |
FILENAME=powersync-sqlite-core.xcframework.zip
echo "fileName=$FILENAME" >> $GITHUB_OUTPUT
- name: Upload xcframework
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
gh release upload "${{ needs.draft_release.outputs.tag }}" powersync-sqlite-core.xcframework.tar.xz
gh release upload "${{ needs.draft_release.outputs.tag }}" ${{ steps.fileName.outputs.fileName }}
# For SPM package
- name: Generate and add checksum to output
id: checksum
run: |
CHECKSUM=$(swift package compute-checksum ${{ steps.fileName.outputs.fileName }})
echo "checksum=$CHECKSUM" >> $GITHUB_OUTPUT
- name: Dispatch release to SPM package
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.SWIFT_PUBLISH_TOKEN }}
repository: powersync-ja/powersync-sqlite-core-swift
event-type: spm-release
client-payload: |-
{
"repository": "${{ github.repository }}",
"title": "${{ needs.draft_release.outputs.tag }}",
"tag": "${{ needs.draft_release.outputs.tag }}",
"checksum": "${{ steps.checksum.outputs.checksum }}"
"fileName": "${{ steps.fileName.outputs.fileName }}"
}
publish_linux_x86_64:
name: Publish Linux x86_64
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ target/
*.xcframework
*.tar.gz
*.tar.xz
*.zip
2 changes: 1 addition & 1 deletion RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Bump the version number in these places:
2. powersync-sqlite-core.podspec.
3. android/build.gradle.kts
4. android/src/prefab/prefab.json
5. build-pod.sh - CFBundleVersion and CFBundleShortVersionString.
5. tool/build_xcframework.sh - CFBundleVersion and CFBundleShortVersionString.
6. `cargo build` to update Cargo.lock

Create a tag:
Expand Down
2 changes: 1 addition & 1 deletion powersync-sqlite-core.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ PowerSync extension for SQLite.
s.license = 'Apache License, Version 2.0'
s.author = 'Journey Mobile, Inc.'

s.source = { :http => "https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v#{s.version}/powersync-sqlite-core.xcframework.tar.xz" }
s.source = { :http => "https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v#{s.version}/powersync-sqlite-core.xcframework.zip" }
s.vendored_frameworks = 'powersync-sqlite-core.xcframework'


Expand Down
2 changes: 1 addition & 1 deletion build-pod.sh → tool/build_xcframework.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ EOF
-output "${BUILD_DIR}/powersync-sqlite-core.xcframework"

cp -Rf "${BUILD_DIR}/powersync-sqlite-core.xcframework" "powersync-sqlite-core.xcframework"
tar -cJvf powersync-sqlite-core.xcframework.tar.xz powersync-sqlite-core.xcframework LICENSE README.md
zip -r powersync-sqlite-core.xcframework.zip powersync-sqlite-core.xcframework LICENSE README.md
rm -rf ${BUILD_DIR}
}

Expand Down

0 comments on commit 1a77b9f

Please sign in to comment.