Mirror: The spec-compliant minimum of client-side GraphQL.
1name: Release
2on:
3 push:
4 branches:
5 - main
6jobs:
7 release:
8 name: Release
9 runs-on: ubuntu-20.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@v3
22 with:
23 fetch-depth: 0
24
25 - name: Setup Node
26 uses: actions/setup-node@v3
27 with:
28 node-version: 18
29
30 - name: Setup pnpm
31 uses: pnpm/action-setup@v2.2.2
32 with:
33 version: 8
34 run_install: false
35
36 - name: Get pnpm store directory
37 id: pnpm-store
38 run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
39
40 - name: Use pnpm store
41 uses: actions/cache@v3
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.4.5
55 with:
56 version: pnpm changeset:version
57 publish: pnpm changeset:publish
58 env:
59 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
60 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
62 - name: Publish Prerelease
63 if: steps.changesets.outputs.published != 'true'
64 env:
65 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
66 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67 run: |
68 npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
69 git reset --hard origin/main
70 pnpm changeset version --no-git-tag --snapshot canary
71 pnpm changeset publish --no-git-tag --snapshot canary --tag canary