Skip to content

Commit 6423f90

Browse files
author
v_guanglwen
committed
feat: 修改workflows
1 parent 573408c commit 6423f90

File tree

2 files changed

+7
-21
lines changed

2 files changed

+7
-21
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
name: WeChat MiniProgram Demo CI/CD
22

33
on:
4-
push:
5-
branches:
6-
- master
74
pull_request:
5+
types: [closed]
86
branches:
97
- master
108
jobs:
119
upload:
10+
if: github.event.pull_request.merged == true && github.repository == 'wechat-miniprogram/miniprogram-demo'
1211
runs-on: ubuntu-latest
1312
steps:
1413
- uses: actions/checkout@v4
@@ -17,16 +16,8 @@ jobs:
1716
submodules: 'recursive'
1817
token: ${{ secrets.GITHUB_TOKEN }}
1918

20-
- name: Verify file existence
21-
run: |
22-
echo "当前工作目录:"
23-
pwd
24-
echo "目录内容:"
25-
ls -la
26-
echo "build目录内容:"
27-
ls -la ./build/
28-
echo "子模块状态:"
29-
git submodule status
19+
- name: Clone submodule
20+
run: git submodule status
3021

3122
- name: Install dependencies
3223
run: npm install

build/ci.js

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,19 @@ import packageJson from '../package.json' with { type: 'json' }
66
const __filename = fileURLToPath(import.meta.url)
77
const __dirname = path.dirname(__filename)
88
const privateKeyPath = path.resolve(__dirname, './key')
9-
try {
10-
const content = fs.readFileSync(privateKeyPath, 'utf8');
11-
console.log('文件内容:', content);
12-
} catch (err) {
13-
console.error('读取文件出错:', err);
14-
}
9+
1510
// 检查私钥文件是否已存在
1611
if (!fs.existsSync(privateKeyPath)) {
1712
const privateKeyContent = process.env.WX_PRIVATE_KEY
1813
if (!privateKeyContent) {
1914
throw new Error('未找到私钥内容,请确保已正确配置 GitHub Secrets')
2015
}
21-
console.log('>>>写入私钥文件:', privateKeyPath);
16+
console.log('>>>>写入私钥文件:', privateKeyPath);
2217
fs.writeFileSync(privateKeyPath, privateKeyContent)
2318
}
2419

2520
const project = new ci.Project({
26-
appid: 'wx622bee4f78fa4f5a',
21+
appid: 'wxe5f52902cf4de896',
2722
type: 'miniProgram',
2823
projectPath: path.resolve(__dirname, '../'),
2924
privateKeyPath: path.resolve(__dirname, './key'),

0 commit comments

Comments
 (0)