Publish (not main) #42
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
name: Publish (not main) | |
on: | |
workflow_dispatch: | |
inputs: | |
channel: | |
type: choice | |
description: NPM channel | |
options: | |
- alpha | |
- beta | |
- previous | |
permissions: | |
contents: write | |
jobs: | |
publish-npm: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v1 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
RELEASE_TAG=v$(node -p "require('./package.json').version") | |
gh release create --prerelease $RELEASE_TAG --target=$GITHUB_SHA --title="$RELEASE_TAG" --generate-notes | |
- run: npm ci | |
- run: npm test | |
- name: Publish to npmjs | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
run: npm publish --access=public --tag=${{ github.event.inputs.channel }} |