Manual NPM Publish #15
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: Manual NPM Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseType: | |
description: "Release type - major, minor or patch" | |
required: true | |
type: choice | |
default: "patch" | |
options: | |
- patch | |
- minor | |
- major | |
additionalFlags: | |
description: "Additional flags for pre-releases, e.g. '--dry-run', '--preRelease=beta' or '--preRelease'" | |
required: false | |
type: string | |
env: | |
NPM_TOKEN: ${{secrets.NPM_TOKEN}} | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v2 | |
- name: Setup Node version | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm install | |
- name: Build Package | |
run: npm run build | |
env: | |
NODE_ENV: production | |
- name: Run tests | |
run: npm test | |
- name: Upload built package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: compiled-package | |
path: build/ | |
release: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v2 | |
- name: Setup Node version | |
uses: actions/setup-node@v2 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- name: Setup Git | |
run: | | |
git config --global user.name "stateful-wombot" | |
git config --global user.email "[email protected]" | |
- name: Install dependencies | |
run: npm install | |
- name: Download built package | |
uses: actions/download-artifact@v4 | |
with: | |
name: compiled-package | |
path: build/ | |
- name: Release | |
run: npm run release:ci -- ${{github.event.inputs.releaseType}} ${{github.event.inputs.additionalFlags}} | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |