Skip to content

release-and-publish-npm #35

release-and-publish-npm

release-and-publish-npm #35

# 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: '[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 }}