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 steps:
12 - name: Checkout Repo
13 uses: actions/checkout@v3
14 with:
15 fetch-depth: 0
16
17 - name: Setup Node
18 uses: actions/setup-node@v3
19 with:
20 node-version: 18
21
22 - name: Setup pnpm
23 uses: pnpm/action-setup@v2.2.2
24 with:
25 version: 7
26 run_install: false
27
28 - name: Get pnpm store directory
29 id: pnpm-store
30 run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)"
31
32 - name: Use pnpm store
33 uses: actions/cache@v3
34 id: pnpm-cache
35 with:
36 path: ${{ steps.pnpm-store.outputs.pnpm_cache_dir }}
37 key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
38 restore-keys: |
39 ${{ runner.os }}-pnpm-
40
41 - name: Install Dependencies
42 run: pnpm install --frozen-lockfile --prefer-offline
43
44 - name: PR or Publish
45 id: changesets
46 uses: changesets/action@v1.4.1
47 with:
48 version: pnpm changeset:version
49 publish: pnpm changeset:publish
50 env:
51 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
52 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53
54 - name: Publish Prerelease
55 if: steps.changesets.outputs.published != 'true'
56 env:
57 NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
58 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
59 run: |
60 npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN"
61 git reset --hard origin/main
62 pnpm changeset version --no-git-tag --snapshot canary
63 pnpm changeset publish --no-git-tag --snapshot canary --tag canary