From cac88f671b3b4090b887a22909385c810a75a622 Mon Sep 17 00:00:00 2001 From: Mugi Khan Date: Tue, 20 Aug 2024 12:12:03 +0200 Subject: [PATCH 1/3] Publish packages based on tag --- .github/workflows/publish.yml | 58 +++++++++++++++++++++++------------ melos.yaml | 2 -- 2 files changed, 38 insertions(+), 22 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index dc94654c..68ea50d7 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,41 +7,59 @@ on: - "powersync_flutter_libs-v[0-9]+.[0-9]+.[0-9]+*" workflow_dispatch: -concurrency: - group: ${{ github.workflow }} - cancel-in-progress: false - jobs: publish-packages: - name: Publish packages + name: Publish powersync + permissions: + contents: write + id-token: write # Required for authentication using OIDC + runs-on: [ubuntu-latest] + if: contains(github.ref_name, 'powersync-v') + steps: + - uses: actions/checkout@v4 + + - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing + + - name: Publish powersync + run: | + dart pub publish --force + working-directory: packages/powersync + + publish-powersync_attachments_helper: + name: Publish powersync_attachments_helper permissions: contents: write id-token: write # Required for authentication using OIDC runs-on: [ubuntu-latest] + if: contains(github.ref_name, 'powersync_attachments_helper-v') steps: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.x" - channel: "stable" + - name: Publish powersync_attachments_helper + run: | + dart pub publish --force + working-directory: packages/powersync_attachments_helper - - name: Install melos - run: flutter pub global activate melos + publish-powersync_flutter_libs: + name: Publish powersync_flutter_libs + permissions: + contents: write + id-token: write # Required for authentication using OIDC + runs-on: [ubuntu-latest] + if: contains(github.ref_name, 'powersync_flutter_libs-v') + steps: + - uses: actions/checkout@v4 - - name: Install dependencies - run: melos bootstrap + - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing - name: Set powersync core version run: echo "CORE_VERSION=v0.1.8" >> $GITHUB_ENV + - name: Download binaries + run: sh tool/download_binaries.sh - - name: Publish packages dry run - run: | - melos publish --yes - - - name: Publish packages + - name: Publish powersync_flutter_libs run: | - melos publish --no-dry-run --yes + dart pub publish --force + working-directory: packages/powersync_flutter_libs diff --git a/melos.yaml b/melos.yaml index d4083fcf..d60a9e16 100644 --- a/melos.yaml +++ b/melos.yaml @@ -15,8 +15,6 @@ command: packageFilters: noPrivate: true publish: - hooks: - pre: sh tool/download_binaries.sh packageFilters: noPrivate: true From 9bf6e93d33df7fb5fb3186fcb8d755ce6f0b9154 Mon Sep 17 00:00:00 2001 From: Mugi Khan Date: Tue, 20 Aug 2024 13:24:36 +0200 Subject: [PATCH 2/3] Dry run before publish --- .github/actions/setup-melos/action.yml | 18 ++++++++++++++++++ .github/workflows/publish.yml | 21 +++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/actions/setup-melos/action.yml diff --git a/.github/actions/setup-melos/action.yml b/.github/actions/setup-melos/action.yml new file mode 100644 index 00000000..6fbbf4ab --- /dev/null +++ b/.github/actions/setup-melos/action.yml @@ -0,0 +1,18 @@ +name: "Setup melos" +description: "Setup melos before publishing" +runs: + using: "composite" + steps: + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.x" + channel: "stable" + + - name: Install melos + run: flutter pub global activate melos + shell: bash + + - name: Install dependencies + run: melos bootstrap + shell: bash diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 68ea50d7..d2e766bf 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -20,6 +20,13 @@ jobs: - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing + - name: Setup melos + uses: ./.github/actions/setup-melos + + - name: Dry run + run: dart pub publish --dry-run + working-directory: packages/powersync + - name: Publish powersync run: | dart pub publish --force @@ -37,6 +44,13 @@ jobs: - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing + - name: Setup melos + uses: ./.github/actions/setup-melos + + - name: Dry run + run: dart pub publish --dry-run + working-directory: packages/powersync_attachments_helper + - name: Publish powersync_attachments_helper run: | dart pub publish --force @@ -54,11 +68,18 @@ jobs: - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing + - name: Setup melos + uses: ./.github/actions/setup-melos + - name: Set powersync core version run: echo "CORE_VERSION=v0.1.8" >> $GITHUB_ENV - name: Download binaries run: sh tool/download_binaries.sh + - name: Dry run + run: dart pub publish --dry-run + working-directory: packages/powersync_flutter_libs + - name: Publish powersync_flutter_libs run: | dart pub publish --force From be565d28db0c1fb2ee74e21c67abdac076974613 Mon Sep 17 00:00:00 2001 From: Mugi Khan Date: Tue, 20 Aug 2024 18:25:58 +0200 Subject: [PATCH 3/3] Publish using melos scope --- .github/actions/setup-melos/action.yml | 18 ------ .github/workflows/publish.yml | 80 +++++++------------------- melos.yaml | 2 + pubspec.lock | 32 ++++++++--- pubspec.yaml | 2 +- tool/download_binaries.sh | 6 +- 6 files changed, 51 insertions(+), 89 deletions(-) delete mode 100644 .github/actions/setup-melos/action.yml diff --git a/.github/actions/setup-melos/action.yml b/.github/actions/setup-melos/action.yml deleted file mode 100644 index 6fbbf4ab..00000000 --- a/.github/actions/setup-melos/action.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: "Setup melos" -description: "Setup melos before publishing" -runs: - using: "composite" - steps: - - name: Install Flutter - uses: subosito/flutter-action@v2 - with: - flutter-version: "3.x" - channel: "stable" - - - name: Install melos - run: flutter pub global activate melos - shell: bash - - - name: Install dependencies - run: melos bootstrap - shell: bash diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index d2e766bf..fb3a0ec4 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -9,78 +9,40 @@ on: jobs: publish-packages: - name: Publish powersync + name: Publish packages permissions: contents: write id-token: write # Required for authentication using OIDC runs-on: [ubuntu-latest] - if: contains(github.ref_name, 'powersync-v') steps: - uses: actions/checkout@v4 - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing - - name: Setup melos - uses: ./.github/actions/setup-melos + - name: Install Flutter + uses: subosito/flutter-action@v2 + with: + flutter-version: "3.x" + channel: "stable" - - name: Dry run - run: dart pub publish --dry-run - working-directory: packages/powersync + - name: Install melos + run: flutter pub global activate melos - - name: Publish powersync - run: | - dart pub publish --force - working-directory: packages/powersync - - publish-powersync_attachments_helper: - name: Publish powersync_attachments_helper - permissions: - contents: write - id-token: write # Required for authentication using OIDC - runs-on: [ubuntu-latest] - if: contains(github.ref_name, 'powersync_attachments_helper-v') - steps: - - uses: actions/checkout@v4 - - - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing - - - name: Setup melos - uses: ./.github/actions/setup-melos - - - name: Dry run - run: dart pub publish --dry-run - working-directory: packages/powersync_attachments_helper + - name: Install dependencies + run: melos bootstrap - - name: Publish powersync_attachments_helper + - name: Get package name from tag + env: + GITHUBREF: ${{ github.ref }} run: | - dart pub publish --force - working-directory: packages/powersync_attachments_helper + PACKAGE_NAME=$(sed -E 's/refs\/tags\/([a-z0-9_]+)-v([0-9]+\.[0-9]+\.[0-9]+)/\1/' <<< $GITHUBREF) && \ + echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV + echo "Package name: $PACKAGE_NAME" - publish-powersync_flutter_libs: - name: Publish powersync_flutter_libs - permissions: - contents: write - id-token: write # Required for authentication using OIDC - runs-on: [ubuntu-latest] - if: contains(github.ref_name, 'powersync_flutter_libs-v') - steps: - - uses: actions/checkout@v4 - - - uses: dart-lang/setup-dart@v1 # Creates and configures token for publishing - - - name: Setup melos - uses: ./.github/actions/setup-melos - - - name: Set powersync core version - run: echo "CORE_VERSION=v0.1.8" >> $GITHUB_ENV - - name: Download binaries - run: sh tool/download_binaries.sh - - - name: Dry run - run: dart pub publish --dry-run - working-directory: packages/powersync_flutter_libs + - name: Publish packages dry run + run: | + melos publish --yes --scope=$PACKAGE_NAME - - name: Publish powersync_flutter_libs + - name: Publish packages run: | - dart pub publish --force - working-directory: packages/powersync_flutter_libs + melos publish --no-dry-run --yes --scope=$PACKAGE_NAME diff --git a/melos.yaml b/melos.yaml index d60a9e16..0f4f76a1 100644 --- a/melos.yaml +++ b/melos.yaml @@ -15,6 +15,8 @@ command: packageFilters: noPrivate: true publish: + hooks: + pre: sh tool/download_binaries.sh v0.1.8 # Download latest core binaries when publishing packageFilters: noPrivate: true diff --git a/pubspec.lock b/pubspec.lock index 0ffee54d..f8e20524 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -73,6 +73,14 @@ packages: url: "https://pub.dev" source: hosted version: "0.4.1" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" collection: dependency: transitive description: @@ -117,10 +125,10 @@ packages: dependency: transitive description: name: file - sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c" url: "https://pub.dev" source: hosted - version: "6.1.4" + version: "7.0.0" frontend_server_client: dependency: transitive description: @@ -169,6 +177,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.2" + intl: + dependency: transitive + description: + name: intl + sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + url: "https://pub.dev" + source: hosted + version: "0.19.0" io: dependency: transitive description: @@ -221,10 +237,10 @@ packages: dependency: "direct dev" description: name: melos - sha256: "96e64bbade5712c3f010137e195bca9f1b351fac34ab1f322af492ae34032067" + sha256: a3f06ed871e0348cb99909ad5ddf5f8b53cc61d894c302b5417d2db1ee7ec381 url: "https://pub.dev" source: hosted - version: "3.4.0" + version: "6.1.0" meta: dependency: transitive description: @@ -293,10 +309,10 @@ packages: dependency: transitive description: name: process - sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32" url: "https://pub.dev" source: hosted - version: "4.2.4" + version: "5.0.2" prompts: dependency: transitive description: @@ -317,10 +333,10 @@ packages: dependency: transitive description: name: pub_updater - sha256: b06600619c8c219065a548f8f7c192b3e080beff95488ed692780f48f69c0625 + sha256: "54e8dc865349059ebe7f163d6acce7c89eb958b8047e6d6e80ce93b13d7c9e60" url: "https://pub.dev" source: hosted - version: "0.3.1" + version: "0.4.0" pubspec: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index 829a05de..47e590f6 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -9,6 +9,6 @@ environment: dev_dependencies: lints: ^2.1.1 - melos: ^3.4.0 + melos: ^6.1.0 test: ^1.25.0 path: ^1.0.0 diff --git a/tool/download_binaries.sh b/tool/download_binaries.sh index 12d243f8..2f8209f7 100644 --- a/tool/download_binaries.sh +++ b/tool/download_binaries.sh @@ -1,11 +1,11 @@ #!/bin/bash -if [ -z "$CORE_VERSION" ]; then - echo "CORE_VERSION is not set"; +if [ -z "$1" ]; then + echo "Core version is not set"; exit 2; fi -github="https://github.com/powersync-ja/powersync-sqlite-core/releases/download/$CORE_VERSION" +github="https://github.com/powersync-ja/powersync-sqlite-core/releases/download/$1" curl "${github}/libpowersync_aarch64.so" -o packages/powersync_flutter_libs/linux/libpowersync_aarch64.so --create-dirs -L -f curl "${github}/libpowersync_x64.so" -o packages/powersync_flutter_libs/linux/libpowersync_x64.so --create-dirs -L -f