Skip to content

Commit 8decd44

Browse files
committed
feat: add release action
1 parent 7fde86c commit 8decd44

2 files changed

Lines changed: 81 additions & 1 deletion

File tree

.github/workflows/release.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Semantic Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- next
8+
- next-major
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
pull-requests: write
14+
packages: write
15+
16+
jobs:
17+
release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
with:
23+
fetch-depth: 0
24+
persist-credentials: false
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v6
28+
with:
29+
node-version: "24"
30+
cache: "pnpm"
31+
32+
# Step 3: Install dependencies
33+
- name: Install dependencies
34+
run: pnpm install --frozen-lockfile
35+
36+
# Step 4: Run tests (optional but recommended)
37+
- name: Run tests
38+
run: pnpm run test --if-present
39+
40+
# Step 5: Build the project
41+
- name: Build
42+
run: pnpm run build --if-present
43+
44+
# Step 6: Run semantic-release
45+
- name: Release
46+
uses: cycjimmy/semantic-release-action@v5
47+
id: semantic
48+
with:
49+
semantic_version: 24
50+
extra_plugins: |
51+
@semantic-release/changelog@v6
52+
@semantic-release/git@v10
53+
@semantic-release/github@v12
54+
@semantic-release/exec@v6
55+
@anolilab/semantic-release-pnpm@v5
56+
branches: |
57+
[
58+
'+([0-9])?(.{+([0-9]),x}).x',
59+
'main',
60+
'next',
61+
{name: 'next-major', prerelease: 'major'},
62+
{name: 'beta', prerelease: true},
63+
{name: 'alpha', prerelease: true}
64+
]
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.SEMANTIC_RELEASE }}
67+
RUNNER_DEBUG: 1
68+
69+
- name: Output release info
70+
if: steps.semantic.outputs.new_release_published == 'true'
71+
run: |
72+
echo "Release Version: ${{ steps.semantic.outputs.new_release_version }}"
73+
echo "Release Published: ${{ steps.semantic.outputs.new_release_published }}"
74+
echo "Release Notes: ${{ steps.semantic.outputs.new_release_notes }}"
75+
76+
# using vercel to deploy
77+
# - name: Deploy to production
78+
# if: steps.semantic.outputs.new_release_published == 'true'
79+
# run: npm run deploy --if-present
80+
# env:
81+
# DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,5 @@ yarn-error.log*
4141
*.tsbuildinfo
4242
next-env.d.ts
4343

44-
.github/
4544
.vscode/
4645
dist/

0 commit comments

Comments
 (0)