Skip to content

Commit

Permalink
Merge pull request #4120 from Agoric/mfig-npm-cicd
Browse files Browse the repository at this point in the history
ci(dev-canary): publish a `dev` NPM dist tag on every push
  • Loading branch information
mergify[bot] authored Dec 2, 2021
2 parents 6932ad0 + 20004f8 commit 78ba139
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions .github/workflows/test-all-packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -61,14 +64,42 @@ jobs:
- name: lint check
run: yarn lint-check

dev-canary:
if: ${{github.event_name == 'push' || github.event.pull_request.merged == 'true'}}
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
strategy:
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
Expand All @@ -91,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
Expand All @@ -112,8 +143,8 @@ jobs:
- uses: nwtgck/[email protected]
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 }}
Expand Down

0 comments on commit 78ba139

Please sign in to comment.