Skip to content

Test/coverage

Test/coverage #42

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:
- name: Check Pull Request Status
run: |
if [ "${{ github.event.pull_request.merged }}" = "true" ]; then
echo "Pull request merged successfully."
else
echo "Pull request not merged. Skipping further steps."
exit 0
fi
- 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 }}