Mirror: The spec-compliant minimum of client-side GraphQL.
1name: Release 2on: 3 push: 4 branches: 5 - main 6 7jobs: 8 release: 9 name: Release 10 runs-on: ubuntu-20.04 11 timeout-minutes: 20 12 permissions: 13 contents: write 14 id-token: write 15 issues: write 16 repository-projects: write 17 deployments: write 18 packages: write 19 pull-requests: write 20 steps: 21 - name: Checkout Repo 22 uses: actions/checkout@v4 23 with: 24 fetch-depth: 0 25 26 - name: Setup Node 27 uses: actions/setup-node@v4 28 with: 29 node-version: 20 30 31 - name: Setup pnpm 32 uses: pnpm/action-setup@v3 33 with: 34 version: 9 35 run_install: false 36 37 - name: Get pnpm store directory 38 id: pnpm-store 39 run: echo "::set-output name=pnpm_cache_dir::$(pnpm store path)" 40 41 - name: Use pnpm store 42 uses: actions/cache@v4 43 id: pnpm-cache 44 with: 45 path: ${{ steps.pnpm-store.outputs.pnpm_cache_dir }} 46 key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }} 47 restore-keys: | 48 ${{ runner.os }}-pnpm- 49 50 - name: Install Dependencies 51 run: pnpm install --frozen-lockfile --prefer-offline 52 53 - name: PR or Publish 54 id: changesets 55 uses: changesets/action@v1.4.5 56 with: 57 version: pnpm changeset:version 58 publish: pnpm changeset:publish 59 env: 60 NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 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 NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 72 DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }} 73 74 - name: Publish Prerelease 75 if: steps.changesets.outputs.published != 'true' 76 env: 77 NPM_TOKEN: ${{ secrets.NPM_TOKEN }} 78 GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 79 run: | 80 npm config set "//registry.npmjs.org/:_authToken" "$NPM_TOKEN" 81 git reset --hard origin/main 82 pnpm changeset version --no-git-tag --snapshot canary 83 pnpm changeset publish --no-git-tag --snapshot canary --tag canary