Skip to content

Fix/GitHub Action

Fix/GitHub Action #36

Workflow file for this run

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Publish Package to npm.js
on:
release:
types: [ published ]
pull_request:
types:
- closed
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v2
- uses: pnpm/action-setup@v2.2.2
with:
version: 8.7.1
- run: pnpm install
- run: pnpm lint
- run: pnpm test
- run: pnpm build
- name: Determine Target Branch
id: determine-branch
run: echo "::set-output name=branch::${{ github.event.pull_request.base.ref }}"
- name: Determine Tag
id: determine-tag
run: echo "::set-output name=tag::${{ steps.determine-branch.outputs.branch == 'master' && 'latest' || 'beta' }}"
- name: Publish Package
uses: JS-DevTools/npm-publish@v2
with:
token: ${{secrets.npm_token}}
provenance: true
tag: ${{ steps.determine-tag.outputs.tag }}