Manual NPM Publish #45
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: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Clone Repository | |
uses: actions/checkout@v4 | |
- name: Setup Node version | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.x | |
registry-url: https://registry.npmjs.org | |
- name: Install dependencies | |
run: npm ci --ignore-scripts | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build / Test Project | |
uses: stateful/runme-action@v2 | |
with: | |
workflows: | | |
build | |
test | |
- name: Setup Git | |
run: | | |
git config --global user.name "stateful-wombot" | |
git config --global user.email "christian+github-bot@stateful.com" | |
- name: Check NPM Auth | |
run: | | |
echo "//npm.pkg.github.com/:_authToken=$NODE_AUTH_TOKEN" > ~/.npmrc | |
npm whoami | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Release | |
run: npx release-it --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir ${{github.event.inputs.releaseType}} ${{github.event.inputs.additionalFlags}} | |
env: | |
NODE_DEBUG: release-it:* | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 🐛 Debug Build | |
uses: stateful/vscode-server-action@v1 | |
if: failure() | |
with: | |
timeout: "300000" |