44 push :
55 branches :
66 - main
7+ workflow_dispatch : # For dev publishing
78
89concurrency : ${{ github.workflow }}-${{ github.ref }}
910
11+ permissions :
12+ id-token : write # Required for OIDC / trusted publishing
13+ contents : write # Required for changesets pushing commits
14+ pull-requests : write # Required for changesets creating PRs
15+
1016jobs :
1117 release-packages :
1218 name : Release Packages
@@ -15,49 +21,39 @@ jobs:
1521 imagePackageReleaseCreated : ${{ steps.check_image_package_release.outputs.release_created }}
1622 steps :
1723 - name : Checkout Repo
18- uses : actions/checkout@v4
19-
24+ uses : actions/checkout@v5
25+ - name : Enable Corepack
26+ run : corepack enable
2027 - name : Setup Node.js
21- uses : actions/setup-node@v4
28+ uses : actions/setup-node@v6
2229 with :
2330 node-version-file : ' .nvmrc'
31+ cache : pnpm
2432
25- - uses : pnpm/action-setup@v4
26- name : Install pnpm
27-
28- - name : Get pnpm store directory
29- shell : bash
30- run : |
31- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
32-
33- - uses : actions/cache@v3
34- name : Setup pnpm cache
35- with :
36- path : ${{ env.STORE_PATH }}
37- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
38- restore-keys : |
39- ${{ runner.os }}-pnpm-store-
33+ - name : Install dependencies
34+ run : pnpm install
4035
41- - name : Add NPM auth
36+ - name : Update npm
4237 run : |
43- echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
38+ npm install -g npm@latest
39+ npm --version
4440
45- - name : Install dependencies
46- run : pnpm install
41+ - name : Build
42+ run : pnpm build:production
4743
4844 - name : Create Release Pull Request or Publish to npm
4945 id : changesets
5046 uses : changesets/action@v1
47+ if : ${{ github.event_name == 'push' }}
5148 with :
5249 # This expects you to have a script called release which does a build for your packages and calls changeset publish
5350 publish : pnpm release
5451 env :
5552 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
5753
5854 - name : Check if @powersync/service-image Released
5955 id : check_image_package_release
60- if : steps.changesets.outputs.published == 'true'
56+ if : ${{ github.event_name == 'push' && steps.changesets.outputs.published == 'true' }}
6157 run : |
6258 packages="${{ toJson(steps.changesets.outputs.publishedPackages) }}"
6359 echo "Packages: $packages" # Debugging output
@@ -77,19 +73,29 @@ jobs:
7773 fi
7874
7975 - name : Debug Outputs
76+ if : ${{ github.event_name == 'push' }}
8077 run : |
8178 echo "Published Packages: ${{ steps.changesets.outputs.publishedPackages }}"
8279 echo "Released Docker Image: ${{ steps.check_image_package_release.outputs.release_created }}"
8380
81+ - name : Dev publish
82+ if : ${{ github.event_name == 'workflow_dispatch' }}
83+ run : |
84+ # If no changesets are available the status check will fail
85+ # We should not continue if there are no changesets
86+ pnpm changeset status
87+ pnpm changeset version --no-git-tag --snapshot dev
88+ pnpm changeset publish --tag dev
89+
8490 release-docker-image :
8591 name : Build and Release powersync-service Docker Image
8692 runs-on : ubuntu-latest
8793 needs : release-packages
8894 # Only run this job if the previous release job created a release for @powersync/service-image
89- if : needs.release-packages.outputs.imagePackageReleaseCreated == 'true'
95+ if : github.event_name == 'push' && needs.release-packages.outputs.imagePackageReleaseCreated == 'true'
9096 steps :
9197 - name : Checkout
92- uses : actions/checkout@v4
98+ uses : actions/checkout@v5
9399 with :
94100 # check out full history
95101 # Temporarily needed for changesets
0 commit comments