- Add semantic-release with changelog and git plugins - Add manual version bump script (patch/minor/major) - Add GitHub Actions workflow for automated releases - Add npm scripts for version management - Setup .releaserc.json for semantic-release configuration
47 lines
1.2 KiB
YAML
47 lines
1.2 KiB
YAML
name: Release
|
|
'on':
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
inputs:
|
|
version_type:
|
|
description: Version bump type
|
|
required: true
|
|
default: patch
|
|
type: choice
|
|
options:
|
|
- patch
|
|
- minor
|
|
- major
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
if: '!contains(github.event.head_commit.message, ''[skip ci]'')'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '18'
|
|
cache: npm
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
- name: Run tests and validation
|
|
run: |
|
|
npm run validate
|
|
npm run format
|
|
- name: Manual version bump
|
|
if: github.event_name == 'workflow_dispatch'
|
|
run: npm run version:${{ github.event.inputs.version_type }}
|
|
- name: Semantic Release
|
|
if: github.event_name == 'push'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
run: npm run release
|