File tree 2 files changed +7
-21
lines changed
2 files changed +7
-21
lines changed Original file line number Diff line number Diff line change 1
1
name : WeChat MiniProgram Demo CI/CD
2
2
3
3
on :
4
- push :
5
- branches :
6
- - master
7
4
pull_request :
5
+ types : [closed]
8
6
branches :
9
7
- master
10
8
jobs :
11
9
upload :
10
+ if : github.event.pull_request.merged == true && github.repository == 'wechat-miniprogram/miniprogram-demo'
12
11
runs-on : ubuntu-latest
13
12
steps :
14
13
- uses : actions/checkout@v4
17
16
submodules : ' recursive'
18
17
token : ${{ secrets.GITHUB_TOKEN }}
19
18
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
30
21
31
22
- name : Install dependencies
32
23
run : npm install
Original file line number Diff line number Diff line change @@ -6,24 +6,19 @@ import packageJson from '../package.json' with { type: 'json' }
6
6
const __filename = fileURLToPath ( import . meta. url )
7
7
const __dirname = path . dirname ( __filename )
8
8
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
+
15
10
// 检查私钥文件是否已存在
16
11
if ( ! fs . existsSync ( privateKeyPath ) ) {
17
12
const privateKeyContent = process . env . WX_PRIVATE_KEY
18
13
if ( ! privateKeyContent ) {
19
14
throw new Error ( '未找到私钥内容,请确保已正确配置 GitHub Secrets' )
20
15
}
21
- console . log ( '>>>写入私钥文件:' , privateKeyPath ) ;
16
+ console . log ( '>>>> 写入私钥文件:' , privateKeyPath ) ;
22
17
fs . writeFileSync ( privateKeyPath , privateKeyContent )
23
18
}
24
19
25
20
const project = new ci . Project ( {
26
- appid : 'wx622bee4f78fa4f5a ' ,
21
+ appid : 'wxe5f52902cf4de896 ' ,
27
22
type : 'miniProgram' ,
28
23
projectPath : path . resolve ( __dirname , '../' ) ,
29
24
privateKeyPath : path . resolve ( __dirname , './key' ) ,
You can’t perform that action at this time.
0 commit comments