From 96d5d2c0c6754234dc2d6741500dddcc2299ab9c Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 09:24:44 -0400 Subject: [PATCH 1/6] ci: simplify setup and use caching --- .github/workflows/publish-to-npm.yml | 24 ++++++++++++------- .github/workflows/release-docs-and-schema.yml | 7 ------ .github/workflows/test.yml | 2 +- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index f45a04513f..6ea7fa013e 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -5,8 +5,6 @@ on: branches-ignore: # No canary deploys for branches opened by dependabot - 'dependabot/**' - # documentation site should not trigger releases - - 'gh-pages' jobs: publish: @@ -14,21 +12,29 @@ jobs: if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'skip ci')" name: Make a release and publish to NPM - steps: - uses: actions/checkout@v3 - - - name: Prepare repository - run: git fetch --unshallow --tags + with: + fetch-depth: 0 - uses: actions/setup-node@v3 with: registry-url: 'https://registry.npmjs.org' + cache: 'yarn' + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Install Node dependencies run: yarn --frozen-lockfile - - run: npm run release + - name: Build + run: yarn build + + - name: Check NPM deployment + run: ./scripts/check-npm.sh + + - name: Create release + run: npx auto shipit env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GH_PAT }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-docs-and-schema.yml b/.github/workflows/release-docs-and-schema.yml index 10e1be7247..6888cda26b 100644 --- a/.github/workflows/release-docs-and-schema.yml +++ b/.github/workflows/release-docs-and-schema.yml @@ -39,13 +39,6 @@ jobs: env: GH_PAT: ${{ secrets.GH_PAT }} - - name: Check NPM deployment - run: ./scripts/check-npm.sh - - - uses: actions/setup-node@v3 - with: - registry-url: 'https://registry.npmjs.org' - - name: Prebuild website run: yarn predeploy:site diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5c1f1946f9..0abc5d3167 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - test-matrix: + test: name: Node runs-on: ubuntu-latest From f67fa3ce9472a9cc1b85f7f82ffcdd697e3452ec Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 09:39:10 -0400 Subject: [PATCH 2/6] Don't build docs branch --- .github/workflows/publish-to-npm.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index 6ea7fa013e..776cf2b663 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -5,6 +5,8 @@ on: branches-ignore: # No canary deploys for branches opened by dependabot - 'dependabot/**' + # documentation site should not trigger releases + - 'gh-pages' jobs: publish: From f9fde306656c2cab55f1c3831a281034a4cfb4da Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 09:40:49 -0400 Subject: [PATCH 3/6] Add shipit script --- .github/workflows/publish-to-npm.yml | 2 +- package.json | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index 776cf2b663..f428f60290 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -36,7 +36,7 @@ jobs: run: ./scripts/check-npm.sh - name: Create release - run: npx auto shipit + run: npm run shipit env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package.json b/package.json index a684dd3aa6..4327d485de 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,8 @@ "watch:site": "yarn build:site -w", "watch:test": "yarn jest --watch test/", "watch:test:runtime": "NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest --watch test-runtime/ --config test-runtime/jest-config.json", - "release": "yarn run prebuild && yarn build && auto shipit" + "release": "yarn run prebuild && yarn build && yarn shipit", + "shipit": "auto shipit" }, "repository": { "type": "git", From 782aa4f70f8a9c33a13cb4b7da9f6794e4c9999a Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 10:17:46 -0400 Subject: [PATCH 4/6] Correct tokens --- .github/workflows/publish-to-npm.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index f428f60290..7314db9788 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -24,7 +24,7 @@ jobs: registry-url: 'https://registry.npmjs.org' cache: 'yarn' env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Install Node dependencies run: yarn --frozen-lockfile @@ -38,5 +38,5 @@ jobs: - name: Create release run: npm run shipit env: - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GH_PAT }} From b93eccd2f98302264579f870f920d1429feba386 Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 10:35:30 -0400 Subject: [PATCH 5/6] try NPM_TOKEN --- .github/workflows/publish-to-npm.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index 7314db9788..6e04108ea2 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -24,7 +24,7 @@ jobs: registry-url: 'https://registry.npmjs.org' cache: 'yarn' env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - name: Install Node dependencies run: yarn --frozen-lockfile @@ -38,5 +38,5 @@ jobs: - name: Create release run: npm run shipit env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GH_PAT }} From 8713057199c8996c6fe3a707f1e4542013d7fa1a Mon Sep 17 00:00:00 2001 From: Dominik Moritz Date: Fri, 12 Aug 2022 10:39:48 -0400 Subject: [PATCH 6/6] add NODE_AUTH_TOKEN --- .github/workflows/publish-to-npm.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/publish-to-npm.yml b/.github/workflows/publish-to-npm.yml index 6e04108ea2..f93a134cf0 100644 --- a/.github/workflows/publish-to-npm.yml +++ b/.github/workflows/publish-to-npm.yml @@ -39,4 +39,5 @@ jobs: run: npm run shipit env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} GITHUB_TOKEN: ${{ secrets.GH_PAT }}