Skip to content

Commit

Permalink
Workflow for publishing npm package
Browse files Browse the repository at this point in the history
  • Loading branch information
aaroncameron-wk committed Jun 22, 2023
1 parent ccbeead commit f31365b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build and publish NPM package

on:
workflow_dispatch:
inputs:
node_version:
default: '19'
description: 'Node version to use'
required: true
type: string

jobs:
build-package:
environment: release
runs-on: ubuntu-22.04
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0 # npm run prod requires tags, sadly this is the only way to get them.
- uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
- name: Install dependencies
run: npm install
- name: Test with npm
run: npm run test
- name: Build with npm
run: npm run prod
- name: Publish with npm
if: startsWith(github.ref, 'refs/tags')
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit f31365b

Please sign in to comment.