-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4120 from Agoric/mfig-npm-cicd
ci(dev-canary): publish a `dev` NPM dist tag on every push
- Loading branch information
Showing
1 changed file
with
38 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -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 }} | ||
|