Skip to content

Feat/deploy GitHub Packages #39

Feat/deploy GitHub Packages

Feat/deploy GitHub Packages #39

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
on:
release:
types: [ published ]
pull_request:
types:
- closed
jobs:
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write # allow GITHUB_TOKEN to publish packages
id-token: write
steps:
- uses: actions/checkout@v2
- uses: pnpm/[email protected]
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 to NPM
uses: JS-DevTools/npm-publish@v2
with:
token: ${{secrets.npm_token}}
provenance: true
tag: ${{ steps.determine-tag.outputs.tag }}
- name: Publish Package to GitHub Packages
uses: JS-DevTools/npm-publish@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
registry: "https://npm.pkg.github.com"
provenance: true
tag: ${{ steps.determine-tag.outputs.tag }}