Skip to content

Commit 6b1742b

Browse files
committed
ci(other): 🔧 update GitHub Actions workflow for package release , enhance Node.js setup, and streamline publishing process
1 parent 8cee346 commit 6b1742b

File tree

1 file changed

+59
-13
lines changed

1 file changed

+59
-13
lines changed

.github/workflows/release.yml

Lines changed: 59 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,66 @@ permissions:
66
on:
77
push:
88
tags:
9-
- "v*"
9+
- "*"
1010

1111
jobs:
1212
release:
13+
if: ${{ github.repository_owner == 'Ohh-889' }}
14+
name: Version & Publish Changed Packages
1315
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v3
16-
with:
17-
fetch-depth: 0
18-
19-
- uses: actions/setup-node@v3
20-
with:
21-
node-version: 18.x
22-
23-
- run: npx githublogen
24-
env:
25-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
21+
steps: # 🧩 Checkout full repository (with history)
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
27+
# 🧰 Setup Node + pnpm environment
28+
- name: Setup Node.js 20
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: 20
32+
cache: "pnpm"
33+
registry-url: 'https://registry.npmjs.org'
34+
35+
- name: Generate changelog
36+
37+
run: npx githublogen
38+
env:
39+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
40+
41+
- name: Setup pnpm
42+
uses: pnpm/action-setup@v4
43+
with:
44+
version: 9.0.6
45+
46+
# 📦 Install dependencies
47+
- name: Install dependencies
48+
run: pnpm install --frozen-lockfile
49+
50+
# 📦 Extract package name from tag
51+
- name: Extract package name from tag
52+
id: package
53+
run: |
54+
TAG_NAME="${GITHUB_REF#refs/tags/}"
55+
PACKAGE_NAME="${TAG_NAME%@*}"
56+
echo "name=$PACKAGE_NAME" >> $GITHUB_OUTPUT
57+
echo "Building package: $PACKAGE_NAME"
58+
shell: bash
59+
60+
# 🏗️ Build package
61+
- name: Build package
62+
run: pnpm --filter ${{ steps.package.outputs.name }} build
63+
shell: bash
64+
65+
# 🏷️ Publish to npm
66+
- name: Publish to npm
67+
run: pnpm --filter ${{ steps.package.outputs.name }} publish --access public --no-git-checks
68+
env:
69+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
70+
71+

0 commit comments

Comments
 (0)