release-and-publish-npm #21
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
# Release and Publish to NPM | |
# Triggered manually (at this point) from a specified branch/tag will perform the `npm run release` | |
name: release-and-publish-npm | |
# Run on workflow dispatch | |
# Currently no custom input | |
on: | |
workflow_dispatch: | |
jobs: | |
build: | |
# Runs on Ubuntu-latest | |
# with node version(s) 12.16.3 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ['12.16.3'] | |
# Checks out the appropriate branch (github.ref) | |
# Creates release tag | |
# Publishes release tag (ish, actually the current ref but on which the tag was based) | |
# Todo: fixup | |
steps: | |
- name: Checking out ${{ github.ref_name }} | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{ github.ref }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install dependencies | |
run: npm ci | |
- name: Build and release tag | |
run: npm run release | |
env: | |
GIT_AUTHOR_NAME: 'kenjdavidson' | |
GIT_AUTHOR_EMAIL: '[email protected]' | |
GIT_COMMITTER_NAME: 'kenjdavidson' | |
GIT_COMMITTER_EMAIL: '[email protected]' | |
- name: Publish released tag to NPM | |
run: | | |
npm config set //registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |