-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add spm to deployment #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
How about creating a dedicated repo where we publish the swift package, instead of pushing to master on this repo? |
I think that could work although it may mean some duplication and more effort. We would need to investigate a way to download the newly created xcframework.zip generated from this repo and add it to a release in that repo. We would also need to be sure to keep the versions in check. I'm not sure we could avoid needing to do a release on this repo followed by a manual release on that repo. It does look like we could do something similar to this https://github.com/realm/SwiftLint/blob/0a1ee180da3787418fbcd3e85013b4ac04e48c72/.github/workflows/release.yml#L18-L27. If you have a security concern about the current approach we could use https://docs.github.com/en/actions/security-for-github-actions/security-guides/automatic-token-authentication the GitHub token and only scope it to that particular job to reduce our risk. |
My concerns are less about security, more about the workflow. Currently our release process is roughly:
If I understand correctly how SPM works, releases are resolved using the tag. That would mean the xcframework would have to be built before the tag, potentially something like this:
But now we run into difficulty upload of the xcframework - it can't be uploaded to a draft release, since the tag for the release doesn't exist yet. Basically a circular dependency issue. Some projects appear to avoid that by placing the xcframework directly in the repo source, but that can quickly bloat the repo. A further general concern here is that SPM always has to download the entire repo - including all the source files etc that it doesn't need. My idea of a separate SPM repo is that it can be fully automated using our current release process. There shouldn't be any duplication required - everything can be managed from this repo. I imagine something like this:
The new powersync-sqlite-core-swift repo only needs the Package.swift file. The xcframework URL can point to the release in this repo. You can think of that repo as the equivalent of a published NPM package, rather than the source we use to publish it. |
I'm not 100% sure how we can test this without a release? |
You can create a "temp" release using something like this:
Then just delete the tag and the draft release afterwards. |
Description
This adds creation of an xcframework.zip file which can be used with SPM. Currently SPM packages must be in
xcframework
orxcframework.zip
format in order to be downloaded by users. This.zip
file is then included in the release. We then use the https://github.com/peter-evans/repository-dispatch?tab=readme-ov-file GitHub action to create anspm-release
event and include the release information in the payload. The event with the payload is handled by powersync-ja/powersync-sqlite-core-swift#1.Work Done
build-pod.sh
file to the more appropriately namedbuild_xcframework.sh
and moved it to thetool
folder. It now also includes generating azip
version of thexcframework
.release
GitHub action workflow so that thexcframework.zip
is included in the release upload.Package.swift
file in that repo.