Skip to content

Release

Release #14

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag to be released'
required: true
jobs:
check:
name: preliminary-checks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Ensure version is properly set
run: |
test "$(npm -s run get-version)" = "${{ github.event.inputs.tag }}"
- name: Give user instruction
if: failure()
run: echo "::error file=package.json,line=6::The tag ${{ github.event.inputs.tag }} must match the version"
publish-github:
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://npm.pkg.github.com'
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish-npm:
runs-on: ubuntu-latest
needs: check
environment: npmjs
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to npmjs.org
- uses: actions/setup-node@v3
with:
node-version: '16'
registry-url: 'https://registry.npmjs.org'
- run: npm install
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
release-github:
runs-on: ubuntu-latest
needs:
- publish-github
- publish-npm
steps:
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.event.inputs.tag }}
name: Release ${{ github.event.inputs.tag }}