Release-it: Create a new release on demand #268
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
# ######################################################################### | |
# Creates a new release using `workflow_dispatch` event trigger with `type` | |
# as input to describe the type of release to create | |
name: 'Release-it: Create a new release on demand' | |
on: | |
workflow_dispatch: | |
inputs: | |
type: | |
description: 'Type. Can be `patch` `minor` or `major`' | |
required: true | |
default: 'patch' | |
jobs: | |
release-it: | |
if: github.actor == 'robertsLando' || github.actor == 'chrisns' || github.actor == 'AlCalzone' | |
runs-on: [ubuntu-latest] | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- name: Checkout master | |
uses: actions/checkout@v4 | |
with: | |
ref: 'master' | |
fetch-depth: 0 # fetch all commits history to create the changelog | |
token: ${{ secrets.BOT_TOKEN }} | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm ci | |
- name: Initialize NPM config | |
run: | | |
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Make the release | |
env: | |
GITHUB_TOKEN: ${{ secrets.BOT_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Z-Wave JS Bot" | |
git config user.password "${{secrets.BOT_TOKEN}}" | |
echo "GIT_USER=${{github.actor}}:${{secrets.BOT_TOKEN}}" >> $GITHUB_ENV | |
npx release-it ${{github.event.inputs.type}} --ci --verbose |