Skip to content

Version 2

Version 2 #15

Workflow file for this run

name: 'Publish NPM Package'
on:
push:
pull_request:
permissions:
contents: 'read'
jobs:
build:
runs-on: 'ubuntu-latest'
steps:
- name: 'Setup node πŸ›ŽοΈ'
uses: 'dudeofawesome/actions/node-setup@v1'
- name: 'Build πŸ—οΈ'
run: 'npm run build'
lint:
runs-on: 'ubuntu-latest'
steps:
- name: 'Setup node πŸ›ŽοΈ'
uses: 'dudeofawesome/actions/node-setup@v1'
- name: 'Lint πŸ§ͺ'
run: 'npm run lint'
test:
runs-on: 'ubuntu-latest'
steps:
- name: 'Setup node πŸ›ŽοΈ'
uses: 'dudeofawesome/actions/node-setup@v1'
- name: 'Test πŸ§ͺ'
run: 'npm run test'
publish:
runs-on: 'ubuntu-latest'
environment: 'production'
permissions:
id-token: 'write'
packages: 'write'
needs:
- 'build'
- 'lint'
- 'test'
steps:
- name: 'Setup node πŸ›ŽοΈ'
uses: 'dudeofawesome/actions/node-setup@v1'
with:
install-modules: false
- name: 'Get variables πŸ“—'
id: 'vars'
run: |
echo "version_already_exists=false" >> "$GITHUB_OUTPUT"
echo "beta_version=true" >> "$GITHUB_OUTPUT"
- name: 'Publish to NPM πŸš€'
if: |
steps.vars.outputs.version_already_exists == 'false'
&& (
github.ref_name == github.event.repository.default_branch
|| steps.vars.outputs.beta_version == 'true'
)
env:
NODE_AUTH_TOKEN: '${{ secrets.NPM_AUTH_TOKEN }}'
run: |-
npm publish \
--workspaces