-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e698932
commit 5a95c36
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: NodeJS Build Check on PR | ||
|
||
# 仅在有PR请求到master分支时触发 | ||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [22.x] # 可以根据项目需要设置Node版本 | ||
|
||
steps: | ||
# 检出仓库代码 | ||
- uses: actions/checkout@v4 | ||
|
||
# 设置Node.js版本 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
# 安装依赖 | ||
- name: Install dependencies | ||
run: | | ||
npm install | ||
# 运行构建 | ||
- name: Build project | ||
run: | | ||
npm run build | ||
# 验证构建是否成功 | ||
- name: Verify build | ||
run: | | ||
if [ ! -d "dist" ]; then | ||
echo "Build failed: dist folder not found." | ||
exit 1 | ||
else | ||
echo "Build succeeded." | ||
fi |