release-and-publish-npm #30
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 | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: ['18'] | |
# 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: Check Git Status | |
run: git status | |
- name: Build and release tag | |
run: npm run release | |
env: | |
GIT_AUTHOR_NAME: 'kenjdavidson' | |
GIT_AUTHOR_EMAIL: 'ken.j.davidson@live.ca' | |
GIT_COMMITTER_NAME: 'kenjdavidson' | |
GIT_COMMITTER_EMAIL: 'ken.j.davidson@live.ca' | |
- 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 }} |