Skip to content

Commit 93dbeb5

Browse files
DominicGBauerDominicGBauer
and
DominicGBauer
authored
feat: add spm release flow (#1)
* feat: add spm release flow * chore: improve wording: --------- Co-authored-by: DominicGBauer <dominic@nomanini.com>
1 parent c4b4c01 commit 93dbeb5

File tree

3 files changed

+73
-2
lines changed

3 files changed

+73
-2
lines changed

.github/workflows/release.yaml

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
on:
2+
repository_dispatch:
3+
types: [spm-release]
4+
name: "release"
5+
jobs:
6+
release:
7+
name: Release SPM package
8+
runs-on: macos-latest
9+
permissions:
10+
contents: write
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
# For SPM package
15+
# We use peter-evans/repository-dispatch to receive the release event information in client_payload
16+
# "repository"
17+
# "title"
18+
# "tag"
19+
# "checksum"
20+
# "fileName"
21+
# For more information see https://github.com/powersync-ja/powersync-sqlite-core/blob/aa09d5dc499bf8d5be383ad95d58cba410ceade7/.github/workflows/release.yml#L76
22+
- name: Update Package.swift with information from powersync-sqlite-core release
23+
run: |
24+
sed -i '' \
25+
-e "s|url: \".*\"|url: \"https://github.com/${{ github.event.client_payload.repository }}/releases/download/${{ github.event.client_payload.tag }}/${{ github.event.client_payload.fileName }}\"|" \
26+
-e "s|checksum: \".*\"|checksum: \"${{ github.event.client_payload.checksum }}\"|" \
27+
Package.swift
28+
29+
- name: Commit and push updated Package.swift
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
run: |
33+
git config user.name github-actions
34+
git config user.email github-actions@github.com
35+
git add Package.swift
36+
git commit -m "Release ${{ github.event.client_payload.tag }}"
37+
git push
38+
39+
- uses: ncipollo/release-action@v1
40+
with:
41+
name: ${{ github.event.client_payload.title }}
42+
tag: ${{ github.event.client_payload.tag }}
43+
body: >
44+
Review the changes made in the
45+
[PowerSync SQLite Core release](https://github.com/${{ github.event.client_payload.repository }}/releases/tag/${{ github.event.client_payload.tag }})
46+
associated with this version.

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: "SHOULD BE UPDATED BY GITHUB ACTION",
21+
checksum: "SHOULD BE UPDATED BY GITHUB ACTION"
22+
)
23+
]
24+
)

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
# powersync-sqlite-core-swift
2-
Swift Package Manager version of powersync-sqlite-core
1+
# PowerSync SQLite Core Swift Package
2+
3+
This is the Swift Package Manager version of[powersync-sqlite-core](https://github.com/powersync-ja/powersync-sqlite-core). See CHANGELOG and more information in that repo.

0 commit comments

Comments
 (0)