Publish Version #1
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
# Copyright 2023 Ayogo Health Inc. | |
name: Publish Version | |
on: | |
workflow_dispatch: | |
inputs: | |
version-type: | |
description: Type of version update to tag | |
required: true | |
type: choice | |
default: patch | |
options: | |
- major | |
- minor | |
- patch | |
- Custom | |
version-str: | |
description: Custom version string (if tagging custom) | |
type: string | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Configure git | |
run: | | |
git config user.name "github-actions[bot]" | |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
- name: Use Node.js 18 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: npm | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install latest npm | |
run: npm install -g npm | |
- name: npm install and test | |
run: npm cit | |
- name: npm version | |
run: | | |
npm version ${{ github.event.inputs.version-type == 'Custom' && github.event.inputs.version-str || github.event.inputs.version-type }} | |
- name: git push | |
run: | | |
git push origin --follow-tags | |
- name: npm publish | |
run: | | |
npm publish --provenance | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |