Release #6
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: Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release-type: | |
description: "Release type" | |
required: true | |
default: "patch" | |
type: choice | |
options: | |
- patch | |
- minor | |
- major | |
- prepatch | |
- preminor | |
- premajor | |
- prerelease | |
env: | |
node_version: 18 | |
concurrency: | |
group: release | |
cancel-in-progress: true | |
permissions: write-all | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup 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 a npm token. REQUIRED | |
registry-url: 'https://registry.npmjs.org' | |
- name: Prepare modules | |
run: npm ci | |
- name: Run tests | |
run: npm test | |
- name: Setup Git | |
run: | | |
git config --global user.email "sikrinick@gmail.com" | |
git config --global user.name "${{ github.actor }}" | |
- name: Increment package version and add tag | |
run: npm version ${{ github.event.inputs.release-type }} | |
- name: Release Tag | |
id: release-tag-retriever | |
run: echo "release-tag=$(git describe --tags)" >> $GITHUB_OUTPUT | |
- name: Push commit and tag | |
run: git push --follow-tags | |
- name: Publish to NPM | |
run: npm publish | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Print Release tag | |
run: echo ${{ steps.release-tag-retreiver.outputs.release-tag }} |