Skip to content

Commit

Permalink
Split out deploy to npm as separate workflow (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrseanryan authored Dec 4, 2022
1 parent af89583 commit d253c97
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/node.js.deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy to npm

# MANUAL execution only
#
# Also runs the full set of tests, with all Node + TypeScript versions.

jobs:
build:
environment: prod
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [10.x, 12.x, 14.x, 16.x, 18.x]
# TODO - add 20.x when it is released
typescript-version: [3, 4]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }} and TypeScript ${{ matrix.typescript-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
registry-url: 'https://registry.npmjs.org'
# npm ci - for a clean install, fails safe
- run: npm ci
- run: npm install --development ${{ matrix.typescript-version }}
- run: npm test
# only deploy to npmjs, if this is master AND this is one particular build (we only want to deploy once!)
- name: Deploy
if: github.ref == 'refs/heads/master' && matrix.node-version == '16.x' && matrix.typescript-version == '4'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - name: Report Code Coverage
# if: matrix.node-version == '16.x' && matrix.typescript-version == 4
# run: npm run report-coverage-to-coveralls
12 changes: 4 additions & 8 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: CI & CD
name: CI

# Automatically runs tests on pull OR push to master.
# Does *not* deploy to npm.

on:
push:
Expand All @@ -19,7 +22,6 @@ jobs:
typescript-version: [3, 4]
steps:
- uses: actions/checkout@v2
# TODO - do we need to setup .npmrc file to publish to npm ?
- name: Use Node.js ${{ matrix.node-version }} and TypeScript ${{ matrix.typescript-version }}
uses: actions/setup-node@v2
with:
Expand All @@ -29,12 +31,6 @@ jobs:
- run: npm ci
- run: npm install --development ${{ matrix.typescript-version }}
- run: npm test
# only deploy to npmjs, if this is master AND this is one particular build (we only want to deploy once!)
# - name: Deploy
# if: github.ref == 'refs/heads/master' && matrix.node-version == '16.x' && matrix.typescript-version == '4'
# run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# - name: Report Code Coverage
# if: matrix.node-version == '16.x' && matrix.typescript-version == 4
# run: npm run report-coverage-to-coveralls

0 comments on commit d253c97

Please sign in to comment.