|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - main |
| 7 | + workflow_dispatch: # For dev publishing |
7 | 8 |
|
8 | 9 | concurrency: ${{ github.workflow }}-${{ github.ref }} |
9 | 10 |
|
| 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 | + |
10 | 16 | jobs: |
11 | 17 | release: |
12 | 18 | name: Release |
13 | 19 | runs-on: ubuntu-latest |
14 | 20 | steps: |
15 | | - - name: Checkout Repo |
16 | | - uses: actions/checkout@v4 |
17 | | - - name: Setup Node.js |
18 | | - uses: actions/setup-node@v4 |
| 21 | + - name: Checkout |
| 22 | + uses: actions/checkout@v5 |
| 23 | + - name: Enable Corepack |
| 24 | + run: corepack enable |
| 25 | + - name: Setup NodeJS |
| 26 | + uses: actions/setup-node@v6 |
19 | 27 | with: |
20 | 28 | node-version-file: '.nvmrc' |
21 | | - - uses: pnpm/action-setup@v2 |
22 | | - name: Install pnpm |
23 | | - with: |
24 | | - # Pnpm 9.4 introduces this https://github.com/pnpm/pnpm/pull/7633 |
25 | | - # which causes workspace:^1.2.0 to be converted to 1.2.0^1.2.0 |
26 | | - version: 9.3 |
27 | | - run_install: false |
28 | | - - name: Get pnpm store directory |
29 | | - shell: bash |
| 29 | + cache: pnpm |
| 30 | + - name: Update npm |
30 | 31 | run: | |
31 | | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
32 | | - - uses: actions/cache@v3 |
33 | | - name: Setup pnpm cache |
34 | | - with: |
35 | | - path: ${{ env.STORE_PATH }} |
36 | | - key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
37 | | - restore-keys: | |
38 | | - ${{ runner.os }}-pnpm-store- |
| 32 | + npm install -g npm@latest |
| 33 | + npm --version |
| 34 | +
|
39 | 35 | - name: Install dependencies |
40 | 36 | run: pnpm install |
| 37 | + - name: Build |
| 38 | + run: pnpm build:packages:prod |
| 39 | + |
41 | 40 | - name: Create Release Pull Request or Publish to npm |
42 | 41 | id: changesets |
| 42 | + if: ${{ github.event_name == 'push' }} |
43 | 43 | uses: changesets/action@v1 |
44 | 44 | with: |
45 | 45 | # Update the monorepo lockfile after versioning |
|
48 | 48 | publish: pnpm release |
49 | 49 | env: |
50 | 50 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
51 | | - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 51 | + |
| 52 | + - name: Publish |
| 53 | + if: ${{ github.event_name == 'workflow_dispatch' }} |
| 54 | + run: | |
| 55 | + pnpm changeset version --no-git-tag --snapshot dev |
| 56 | + pnpm changeset publish --tag dev |
0 commit comments