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: 8.6.1
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: Update npm
53 run: npm install -g npm@11.6.2
54
55 - name: PR or Publish
56 id: changesets
57 uses: changesets/action@v1.5.3
58 with:
59 publish: pnpm changeset publish
60 env:
61 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62
63 - name: Notify discord
64 id: discord-msg
65 if: steps.changesets.outputs.published == 'true'
66 uses: ./.github/actions/discord-message
67 with:
68 publishedPackages: ${{ steps.changesets.outputs.publishedPackages }}
69 env:
70 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
72
73 - name: Publish Prerelease
74 if: steps.changesets.outputs.published != 'true'
75 continue-on-error: true
76 env:
77 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78 run: |
79 git reset --hard origin/main
80 pnpm changeset version --no-git-tag --snapshot canary
81 pnpm changeset publish --no-git-tag --snapshot canary --tag canary