Skip to content

Release-it: Create a new release on demand #53

Release-it: Create a new release on demand

Release-it: Create a new release on demand #53

Workflow file for this run

# #########################################################################
# 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/Options. `major --preRelease=beta`, `--preRelease`, `major`, `patch`, `minor` or `major`'
required: false
default: 'patch'
jobs:
release:
permissions:
contents: write
id-token: write
runs-on: [ubuntu-latest]
strategy:
matrix:
node-version: [18.x]
steps:
- name: Checkout main
uses: actions/checkout@v4
with:
ref: 'main'
fetch-depth: 0 # fetch all commits history to create the changelog
token: ${{ secrets.GH_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 Git user
run: |
git config --global user.email "${{ github.actor }}@users.noreply.github.com }}"
git config --global user.name "${{ github.actor }}"
- 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.GH_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
# When all commits since the latest major tag should be added to the changelog, use --git.tagExclude='*[-]*'
npx release-it ${{github.event.inputs.type}} --git.tagExclude='*[-]*' --ci --verbose