Skip to content

Commit f4f7c33

Browse files
authored
Merge pull request #136 from powersync-ja/chore/automate-package-publishing
Automate package publishing
2 parents 85bdb7d + fac2ce1 commit f4f7c33

File tree

11 files changed

+87
-183
lines changed

11 files changed

+87
-183
lines changed

.github/workflows/publish.yml

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
name: Publish packages
2-
on: workflow_dispatch
2+
on:
3+
push:
4+
tags:
5+
- "powersync-v[0-9]+.[0-9]+.[0-9]+"
6+
- "powersync_attachments_helper-v[0-9]+.[0-9]+.[0-9]+*"
7+
- "powersync_flutter_libs-v[0-9]+.[0-9]+.[0-9]+*"
8+
workflow_dispatch:
39

410
jobs:
511
publish-packages:
@@ -9,11 +15,20 @@ jobs:
915
id-token: write # Required for authentication using OIDC
1016
runs-on: [ubuntu-latest]
1117
steps:
12-
- uses: actions/checkout@v3
13-
- uses: subosito/flutter-action@v2
14-
with:
15-
flutter-version: '3.x'
16-
channel: 'stable'
17-
- uses: bluefireteam/melos-action@v3
18-
with:
19-
publish: true
18+
- uses: actions/checkout@v4
19+
20+
- uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing
21+
22+
- name: Install melos
23+
run: dart pub global activate melos
24+
25+
- name: Set powersync core version
26+
run: echo "CORE_VERSION=v0.1.8" >> $GITHUB_ENV
27+
28+
- name: Publish packages dry run
29+
run: |
30+
melos publish
31+
32+
- name: Publish packages
33+
run: |
34+
melos publish --no-dry-run

.github/workflows/release.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ name: Compile Assets and Create Draft Release
44
on:
55
push:
66
tags:
7-
# Trigger on tags beginning with 'v'
8-
# Note that `melos version ...` adds the package name as a suffix
9-
# This action is not compatible with tags such as `powersync-v1.1.1`
10-
# marvinpinto/action-automatic-releases struggles to generate changelogs
11-
# Be sure to manually tag the commit to trigger this action
127
- "powersync-v[0-9]+.[0-9]+.[0-9]+"
138

149
jobs:
@@ -40,5 +35,5 @@ jobs:
4035
run: |
4136
tag="${{ github.ref_name }}"
4237
body="Release $tag"
43-
gh release create --draft "$tag" --title "$tag" --notes "$body" --generate-notes --prerelease
38+
gh release create --draft "$tag" --title "$tag" --notes "$body" --generate-notes
4439
gh release upload "${{ github.ref_name }}" packages/powersync/assets/powersync_db.worker.js

RELEASING.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Preparing Release
2+
3+
Bump the version of the packages to be released using `melos`:
4+
5+
```
6+
melos version
7+
```
8+
9+
if melos does not pick up changes or does not bump the version correctly, you can manually version the packages using
10+
11+
```
12+
melos version -V ${PACKAGE_NAME}:M.M.P
13+
for e.g melos version -V powersync:1.6.3
14+
```
15+
16+
This will create a tag for all packages updated in the format of ${PACKAGE_NAME}-vM.M.P
17+
18+
```
19+
e.g powersync-v1.6.4, powersync_attachments_helper-v0.6.3+1, etc.
20+
```
21+
22+
# Perform Release
23+
24+
```
25+
git push --follow-tags
26+
```
27+
28+
A version bump and tag push for `powersync` will also create a draft github release for the powersync web worker. The worker needs to be manually published in the GitHub [releases](https://github.com/powersync-ja/powersync.dart/releases).

melos.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ command:
1414
changelog: false
1515
packageFilters:
1616
noPrivate: true
17+
publish:
18+
hooks:
19+
pre: sh tool/download_binaries.sh
20+
packageFilters:
21+
noPrivate: true
1722

1823
scripts:
1924
prepare:

packages/powersync/lib/src/open_factory/native/native_open_factory.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,11 @@ class PowerSyncOpenFactory extends AbstractPowerSyncOpenFactory {
8484
case Abi.macosX64:
8585
return 'libpowersync.dylib';
8686
case Abi.linuxX64:
87-
return 'libpowersync.so';
88-
case Abi.windowsArm64:
87+
return 'libpowersync_x64.so';
88+
case Abi.linuxArm64:
89+
return 'libpowersync_aarch64.so';
8990
case Abi.windowsX64:
90-
return 'powersync.dll';
91+
return 'powersync_x64.dll';
9192
case Abi.androidIA32:
9293
throw PowersyncNotReadyException(
9394
'Unsupported processor architecture. X86 Android emulators are not '

packages/powersync/test/util.dart

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

packages/powersync/test/utils/native_test_utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ class TestOpenFactory extends PowerSyncOpenFactory {
3535
case Abi.macosX64:
3636
return '$path/libpowersync.dylib';
3737
case Abi.linuxX64:
38+
case Abi.linuxArm64:
3839
return '$path/libpowersync.so';
39-
case Abi.windowsArm64:
4040
case Abi.windowsX64:
4141
return '$path/powersync.dll';
4242
case Abi.androidIA32:

packages/powersync_flutter_libs/linux/CMakeLists.txt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,19 @@ target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}
2323
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter)
2424

2525
# ----------------------------------------------------------------------
26-
# Download and add powersync prebuilt library.
26+
# Add powersync prebuilt library.
2727

2828
set(POWERSYNC_VERSION 0.1.6)
29+
set(CORE_FILE_NAME "libpowersync.so")
2930

3031
set(POWERSYNC_ARCH ${CMAKE_SYSTEM_PROCESSOR})
3132
if (${POWERSYNC_ARCH} MATCHES "x86_64" OR ${POWERSYNC_ARCH} MATCHES "AMD64")
32-
set(POWERSYNC_ARCH x64)
33+
set(CORE_FILE_NAME "libpowersync_x64.so")
3334
elseif (${POWERSYNC_ARCH} MATCHES "^arm64" OR ${POWERSYNC_ARCH} MATCHES "^armv8")
34-
set(POWERSYNC_ARCH aarch64)
35+
set(CORE_FILE_NAME "libpowersync_aarch64.so")
3536
endif ()
3637

37-
set(POWERSYNC_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libpowersync.so")
38-
39-
file(DOWNLOAD
40-
"https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v${POWERSYNC_VERSION}/libpowersync_${POWERSYNC_ARCH}.so"
41-
${POWERSYNC_FILE_PATH}
42-
)
38+
set(POWERSYNC_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/${CORE_FILE_NAME}")
4339

4440
# ----------------------------------------------------------------------
4541

packages/powersync_flutter_libs/windows/CMakeLists.txt

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,18 @@ target_include_directories(${PLUGIN_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}
2424
target_link_libraries(${PLUGIN_NAME} PRIVATE flutter flutter_wrapper_plugin)
2525

2626
# ----------------------------------------------------------------------
27-
# Download and add powersync prebuilt library.
28-
29-
set(POWERSYNC_VERSION 0.1.6)
27+
# Add powersync prebuilt library.
3028

3129
set(POWERSYNC_ARCH ${CMAKE_SYSTEM_PROCESSOR})
30+
set(CORE_FILE_NAME "powersync.dll")
31+
3232
if (${POWERSYNC_ARCH} MATCHES "x86_64" OR ${POWERSYNC_ARCH} MATCHES "AMD64")
33-
set(POWERSYNC_ARCH x64)
33+
set(CORE_FILE_NAME "powersync_x64.dll")
3434
elseif (${POWERSYNC_ARCH} MATCHES "^arm64" OR ${POWERSYNC_ARCH} MATCHES "^armv8")
35-
set(POWERSYNC_ARCH aarch64)
35+
message(FATAL_ERROR "Unsupported architecture: ${POWERSYNC_ARCH}, we are working on adding support for windows arm.")
3636
endif ()
3737

38-
set(POWERSYNC_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/powersync.dll")
39-
40-
file(DOWNLOAD
41-
"https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v${POWERSYNC_VERSION}/powersync_${POWERSYNC_ARCH}.dll"
42-
${POWERSYNC_FILE_PATH}
43-
)
38+
set(POWERSYNC_FILE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/powersync_x64.dll")
4439

4540
# ----------------------------------------------------------------------
4641

scripts/init_powersync_core_binary.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import 'dart:io';
66
import 'package:melos/melos.dart';
77

88
final sqliteUrl =
9-
'https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v0.1.7';
9+
'https://github.com/powersync-ja/powersync-sqlite-core/releases/download/v0.1.8';
1010

1111
void main() async {
1212
final sqliteCoreFilename = getLibraryForPlatform();

tool/download_binaries.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
if [ -z "$CORE_VERSION" ]; then
4+
echo "CORE_VERSION is not set";
5+
exit 2;
6+
fi
7+
8+
github="https://github.com/powersync-ja/powersync-sqlite-core/releases/download/$CORE_VERSION"
9+
10+
curl "${github}/libpowersync_aarch64.so" -o packages/powersync_flutter_libs/linux/libpowersync_aarch64.so --create-dirs -L -f
11+
curl "${github}/libpowersync_x64.so" -o packages/powersync_flutter_libs/linux/libpowersync_x64.so --create-dirs -L -f
12+
curl "${github}/powersync_x64.dll" -o packages/powersync_flutter_libs/windows/powersync_x64.dll --create-dirs -L -f

0 commit comments

Comments
 (0)