Skip to content

feat: improve release ci #2

feat: improve release ci

feat: improve release ci #2

Workflow file for this run

name: Semantic Release
on:
push:
branches:
- main
- next
- next-major
workflow_dispatch:
permissions:
contents: write
pull-requests: write
packages: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
version: 10
run_install: false
- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version: "24"
cache: "pnpm"
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
node-version: "24"
cache: "pnpm"
# Step 3: Install dependencies
- name: Install dependencies
run: pnpm install --frozen-lockfile
# Step 4: Run tests (optional but recommended)
- name: Run tests
run: pnpm run test --if-present
# Step 5: Build the project
- name: Build
run: pnpm run build --if-present
# Step 6: Run semantic-release
- name: Release
uses: cycjimmy/semantic-release-action@v5
id: semantic
with:
semantic_version: 24
extra_plugins: |
@semantic-release/changelog@v6
@semantic-release/git@v10
@semantic-release/github@v12
@semantic-release/exec@v6
@anolilab/semantic-release-pnpm@v5
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
{name: 'next-major', prerelease: 'major'},
{name: 'beta', prerelease: true},
{name: 'alpha', prerelease: true}
]
env:
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE }}
RUNNER_DEBUG: 1
- name: Output release info
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo "Release Version: ${{ steps.semantic.outputs.new_release_version }}"
echo "Release Published: ${{ steps.semantic.outputs.new_release_published }}"
echo "Release Notes: ${{ steps.semantic.outputs.new_release_notes }}"
# using vercel to deploy
# - name: Deploy to production
# if: steps.semantic.outputs.new_release_published == 'true'
# run: npm run deploy --if-present
# env:
# DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}