Publish #188
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: Publish | |
on: | |
workflow_dispatch: | |
inputs: | |
version-type: | |
type: choice | |
description: Which version type to bump | |
options: | |
- patch | |
- minor | |
- major | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- name: Setup Node.js environment | |
uses: actions/[email protected] | |
with: | |
node-version: 'lts/*' | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Test & Build | |
run: | | |
npm ci | |
npm run test:prod | |
npm run build | |
- name: Version Bump | |
id: version-bump | |
uses: phips28/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag-prefix: 'v' | |
# Can't use commit wording because manually dispatched workflows don't contain the commits | |
version-type: ${{ github.event.inputs.version-type }} | |
- name: Rebuild | |
run: | | |
npm install | |
npm run build | |
- name: Publish | |
uses: JS-DevTools/npm-publish@v3 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
package: package.json | |
- name: Create Release | |
uses: actions/create-release@v1 | |
with: | |
tag_name: ${{ steps.version-bump.outputs.newTag }} | |
release_name: ${{ steps.version-bump.outputs.newTag }} |