Skip to content

Release

Release #1

Workflow file for this run

name: Release
on:
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g., 0.1.1)'
required: true
type: string
release_type:
description: 'Type of release'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
- prerelease
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Configure Git
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run lint
- name: Update version
run: |
npm version ${{ github.event.inputs.version }} --no-git-tag-version
git add package.json package-lock.json
git commit -m "Release version ${{ github.event.inputs.version }}"
git tag -a "v${{ github.event.inputs.version }}" -m "Release ${{ github.event.inputs.version }}"
git push origin main --tags
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
tag_name: v${{ github.event.inputs.version }}
name: Release ${{ github.event.inputs.version }}
generate_release_notes: true
draft: false
prerelease: ${{ github.event.inputs.release_type == 'prerelease' }}