1name: Release
2on:
3 push:
4 branches:
5 - main
6jobs:
7 release:
8 name: Release
9 runs-on: ubuntu-24.04
10 timeout-minutes: 20
11 permissions:
12 contents: write
13 id-token: write
14 issues: write
15 repository-projects: write
16 deployments: write
17 packages: write
18 pull-requests: write
19 steps:
20 - name: Checkout Repo
21 uses: actions/checkout@v4
22 with:
23 fetch-depth: 0
24
25 - name: Setup Node
26 uses: actions/setup-node@v4
27 with:
28 node-version: 20
29
30 - name: Setup pnpm
31 uses: pnpm/action-setup@v3
32 with:
33 version: 9
34 run_install: false
35
36 - name: Get pnpm store directory
37 id: pnpm-store
38 run: echo "pnpm_cache_dir=$(pnpm store path)" >> $GITHUB_OUTPUT
39
40 - name: Use pnpm store
41 uses: actions/cache@v4
42 id: pnpm-cache
43 with:
44 path: ${{ steps.pnpm-store.outputs.pnpm_cache_dir }}
45 key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
46 restore-keys: |
47 ${{ runner.os }}-pnpm-
48
49 - name: Install Dependencies
50 run: pnpm install --frozen-lockfile --prefer-offline
51
52 - name: PR or Publish
53 id: changesets
54 uses: changesets/action@v1.5.3
55 with:
56 publish: pnpm changeset publish
57 env:
58 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59
60 - name: Notify discord
61 id: discord-msg
62 if: steps.changesets.outputs.published == 'true'
63 uses: ./.github/actions/discord-message
64 with:
65 publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
66 env:
67 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
69
70 - name: Publish Prerelease
71 if: steps.changesets.outputs.published != 'true'
72 continue-on-error: true
73 env:
74 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75 run: |
76 git reset --hard origin/main
77 pnpm changeset version --no-git-tag --snapshot canary
78 pnpm changeset publish --no-git-tag --snapshot canary --tag canary