Skip to content

Publish new version to NPM #4

Publish new version to NPM

Publish new version to NPM #4

name: Publish new version to NPM
on:
workflow_dispatch:
inputs:
release_type:
description: 'Release Type'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
dry_run:
description: 'Dry Run'
required: true
default: 'false'
type: choice
options:
- true
- false
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build_and_release:
environment: production
if: github.ref == 'refs/heads/trunk'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'
- name: Configure git user name and email
run: |
git config user.name "10up Bot"
git config user.email "[email protected]"
- name: Install all npm packages
run: npm ci
- name: npm update version and release
run: |
npm version ${{ github.event.inputs.release_type }} --git-tag-version=${{ github.event.inputs.dry_run == 'false' }}
npm publish --dry-run=${{ github.event.inputs.dry_run }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: push release commit to repo
run: git push