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
1319 runs-on : ubuntu-latest
1420 steps :
1521 - name : Checkout Repo
16- uses : actions/checkout@v4
22+ uses : actions/checkout@v5
23+ - name : Enable Corepack
24+ run : corepack enable
1725
1826 - name : Setup Node.js
19- uses : actions/setup-node@v4
27+ uses : actions/setup-node@v6
2028 with :
2129 node-version-file : ' .nvmrc'
22-
23- - uses : pnpm/action-setup@v4
24- name : Install pnpm
25- with :
26- version : 9
27- run_install : false
28-
29- - name : Get pnpm store directory
30- shell : bash
31- run : |
32- echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
33-
34- - uses : actions/cache@v3
35- name : Setup pnpm cache
36- with :
37- path : ${{ env.STORE_PATH }}
38- key : ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
39- restore-keys : |
40- ${{ runner.os }}-pnpm-store-
41-
42- - name : Add NPM auth
43- run : |
44- echo "//registry.npmjs.org/:_authToken=${{secrets.NPM_TOKEN}}" >> ~/.npmrc
30+ cache : pnpm
4531
4632 - name : Install dependencies
4733 run : pnpm install
34+ - name : Update npm
35+ run : |
36+ npm install -g npm@latest
37+ npm --version
4838
4939 - name : Create Release Pull Request or Publish to npm
5040 id : changesets
5141 uses : changesets/action@v1
42+ if : ${{ github.event_name == 'push' }}
5243 with :
5344 # This expects you to have a script called release which does a build for your packages and calls changeset publish
5445 publish : pnpm release
5546 version : pnpm changeset version
5647 env :
5748 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
58- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
5949
6050 - name : Debug Outputs
51+ if : ${{ github.event_name == 'push' }}
6152 run : |
62- echo "Published Packages: ${{ steps.changesets.outputs.publishedPackages }}"
53+ echo "Published Packages: ${{ steps.changesets.outputs.publishedPackages }}"
54+
55+ - name : Dev publish
56+ if : ${{ github.event_name == 'workflow_dispatch' }}
57+ run : |
58+ pnpm changeset version --no-git-tag --snapshot dev
59+ pnpm changeset publish --tag dev
60+ env :
61+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments