Skip to content

Commit 2414f9d

Browse files
authored
Merge branch 'feat-wzy-cs' into feat-xxx
2 parents 2bf4bd3 + 63e63fa commit 2414f9d

File tree

2 files changed

+0
-98
lines changed

2 files changed

+0
-98
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +0,0 @@
1-
name: WeChat MiniProgram Demo CI/CD
2-
3-
on:
4-
5-
pull_request:
6-
7-
branches:
8-
- feat-ce
9-
jobs:
10-
upload:
11-
runs-on: ubuntu-latest
12-
environment: PR_CI
13-
steps:
14-
- uses: actions/checkout@v4
15-
with:
16-
fetch-depth: 0
17-
submodules: 'recursive'
18-
token: ${{ secrets.GITHUB_TOKEN }}
19-
20-
21-
- name: Upload MiniProgram
22-
env:
23-
WX_PRIVATE_KEY: ${{ secrets.WX_PRIVATE_KEY }}
24-
run: |
25-
# 验证密钥是否为空
26-
if [ -z "$WX_PRIVATE_KEY" ]; then
27-
echo "❌ 错误: WX_PRIVATE_KEY 为空,请检查 GitHub Secrets 设置"
28-
exit 1
29-
fi
30-
mkdir -p ./build
31-
echo "$WX_PRIVATE_KEY" > ./build/key
32-
33-
echo "$WX_PRIVATE_KEY" | xxd
34-

build/ci.js

Lines changed: 0 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +0,0 @@
1-
import path from 'path'
2-
import { fileURLToPath } from 'url'
3-
import fs from 'fs'
4-
import ci from 'miniprogram-ci'
5-
import packageJson from '../package.json' with { type: 'json' }
6-
const __filename = fileURLToPath(import.meta.url)
7-
const __dirname = path.dirname(__filename)
8-
const privateKeyPath = path.resolve(__dirname, './key')
9-
10-
try {
11-
const content = fs.readFileSync(privateKeyPath, 'utf8');
12-
console.log('文件内容:', content);
13-
} catch (err) {
14-
console.error('读取文件出错:', err);
15-
}
16-
17-
// 检查私钥文件是否已存在
18-
if (!fs.existsSync(privateKeyPath)) {
19-
const privateKeyContent = process.env.WX_PRIVATE_KEY
20-
if (!privateKeyContent) {
21-
throw new Error('未找到私钥内容,请确保已正确配置 GitHub Secrets')
22-
}
23-
console.log('>>>>写入私钥文件:', privateKeyPath);
24-
fs.writeFileSync(privateKeyPath, privateKeyContent)
25-
}
26-
27-
const project = new ci.Project({
28-
appid: 'wx622bee4f78fa4f5a',
29-
type: 'miniProgram',
30-
projectPath: path.resolve(__dirname, '../'),
31-
privateKeyPath: path.resolve(__dirname, './key'),
32-
ignores: [path.resolve(__dirname, '../miniprogram/node_modules/**/*')]
33-
})
34-
const robotNumber = 2
35-
const params = {
36-
onProgressUpdate: console.log,
37-
robot: robotNumber,
38-
version: packageJson.version,
39-
desc: packageJson.bundleDescription,
40-
setting: {
41-
es7: true,
42-
minifyJS: true,
43-
minifyWXML: true,
44-
minifyWXSS: true,
45-
codeProtect: false,
46-
autoPrefixWXSS: true,
47-
ignoreUploadUnusedFiles: true
48-
},
49-
}
50-
await ci.packNpm(project, {})
51-
ci.upload({
52-
project,
53-
...params
54-
}).then(res => {
55-
console.debug('>>>>upload res', res)
56-
}).catch(err => {
57-
console.error('>>>>upload error', err)
58-
throw err
59-
}).finally(() => {
60-
// 删除临时私钥文件
61-
fs.unlinkSync(privateKeyPath)
62-
})
63-
64-

0 commit comments

Comments
 (0)