diff --git a/.github/workflows/node.js.deploy.yml b/.github/workflows/node.js.deploy.yml new file mode 100644 index 0000000..de50260 --- /dev/null +++ b/.github/workflows/node.js.deploy.yml @@ -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 diff --git a/.github/workflows/node.js.yml b/.github/workflows/node.js.yml index ad51223..fd43125 100644 --- a/.github/workflows/node.js.yml +++ b/.github/workflows/node.js.yml @@ -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: @@ -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: @@ -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