Skip to content

Commit

Permalink
chore: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
robertsLando committed Oct 1, 2024
1 parent 76bc9d0 commit d1b15b3
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release-it.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# #########################################################################
# 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
packages: 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.GITHUB_TOKEN }}

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'

- name: Install dependencies
run: yarn install --ignore-engines

- 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.GITHUB_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

0 comments on commit d1b15b3

Please sign in to comment.