From e5e6e07d01d0d3e047dea41d60b4cc9f83ce8539 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Wed, 24 Nov 2021 11:00:48 -0600 Subject: [PATCH 1/2] ci(dev-canary): publish a `dev` NPM dist tag on every push --- .github/workflows/test-all-packages.yml | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index 2645314df45..a3249181e69 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -61,6 +61,34 @@ jobs: - name: lint check run: yarn lint-check + dev-canary: + if: ${{github.event_name == 'push'}} + needs: build + runs-on: ubuntu-latest + strategy: + matrix: + # note: only use one node-version + node-version: ['14.x'] + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/restore-node + with: + node-version: ${{ matrix.node-version }} + + # Adapted from https://johnny.sh/notes/publish-canary-lerna-cicd/ + - name: configure NPM token + run: | + echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + - name: check credentials + run: npm whoami + - name: publish to NPM dev tag + run: | + yarn lerna publish --conventional-prerelease --canary --exact \ + --dist-tag=dev --preid=dev-$(git rev-parse --short=7 HEAD) \ + --no-push --no-verify-access --yes + benchmark: needs: build runs-on: ubuntu-latest From 20004f8baaac44a6d4d341a91a73bf3d87602cb7 Mon Sep 17 00:00:00 2001 From: Michael FIG Date: Tue, 30 Nov 2021 22:48:27 -0600 Subject: [PATCH 2/2] ci: ensure jobs run when the PR is merged to `master` --- .github/workflows/test-all-packages.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-all-packages.yml b/.github/workflows/test-all-packages.yml index a3249181e69..b80df9a37fd 100644 --- a/.github/workflows/test-all-packages.yml +++ b/.github/workflows/test-all-packages.yml @@ -4,9 +4,12 @@ name: Test all Packages # branches) on: - push: - branches: [ $default-branch ] - pull_request: + push: + branches: [ $default-branch ] + pull_request: + # Include default types, and also `closed` + # See https://docs.github.com/en/actions/learn-github-actions/events-that-trigger-workflows#pull_request + types: [opened, reopened, synchronize, closed] # set ESM_DISABLE_CACHE=true (will be JSON parsed) jobs: @@ -62,7 +65,7 @@ jobs: run: yarn lint-check dev-canary: - if: ${{github.event_name == 'push'}} + if: ${{github.event_name == 'push' || github.event.pull_request.merged == 'true'}} needs: build runs-on: ubuntu-latest strategy: @@ -96,7 +99,7 @@ jobs: matrix: # note: only use one node-version node-version: ['14.x'] - if: ${{github.event_name == 'push'}} + if: ${{github.event_name == 'push' || github.event.pull_request.merged == 'true'}} steps: - uses: actions/checkout@v2 - uses: ./.github/actions/restore-node @@ -119,7 +122,7 @@ jobs: matrix: # note: only use one node-version node-version: ['14.x'] - if: ${{github.event_name == 'push'}} + if: ${{github.event_name == 'push' || github.event.pull_request.merged == 'true'}} steps: - uses: actions/checkout@v2 - uses: ./.github/actions/restore-node @@ -140,8 +143,8 @@ jobs: - uses: nwtgck/actions-netlify@v1.1 with: - # Production deployment if a push. - production-deploy: ${{github.event_name == 'push'}} + # Production deployment if a push or merged PR. + production-deploy: ${{github.event_name == 'push' || github.event.pull_request.merged == 'true'}} publish-dir: coverage/html # SECURITY: we don't want to hand out the Github token to this action. # github-token: ${{ secrets.GITHUB_TOKEN }}