gritzkoo-npm-poc
Version:
Poc to automate github actions deployment
47 lines (43 loc) • 1.5 kB
YAML
name: Version and Release
on:
workflow_dispatch:
inputs:
newversion:
type: choice
options:
- major
- minor
- path
default: path
description: 'Semantic Version Bump Type (major minor patch)'
required: true
env:
node_version: lts/*
concurrency: # prevent concurrent releases
group: npm-bump
cancel-in-progress: true
jobs:
version_and_release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
# fetch full history so things like auto-changelog work properly
fetch-depth: 0
- name: Use Node.js ${{ env.node_version }}
uses: actions/setup-node@v3
with:
node-version: ${{ env.node_version }}
# setting a registry enables the NODE_AUTH_TOKEN env variable where we can set an npm token. REQUIRED
registry-url: 'https://registry.npmjs.org'
- run: npm i
- run: npm test
- name: Version and publish to npm
uses: bcomnes/npm-bump@v2.0.2
with:
git_email: gritzkoo@hotmail.com
git_username: ${{ github.actor }}
newversion: ${{ github.event.inputs.newversion }}
push_version_commit: true # if your prePublishOnly step pushes git commits, you can omit this input or set it to false.
github_token: ${{ secrets.GITHUB_TOKEN }} # built in actions token. Passed tp gh-release if in use.
npm_token: ${{ secrets.NPM_TOKEN }} # user set secret token generated at npm