diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01376cff..e0c4f506 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,13 +1,18 @@ name: WeChat MiniProgram Demo CI/CD - on: + push: + branches: + - master pull_request: - types: [closed] branches: - master + +permissions: + contents: read + actions: read + jobs: upload: - if: github.event.pull_request.merged == true && github.repository == 'wechat-miniprogram/miniprogram-demo' runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -29,7 +34,12 @@ jobs: env: WX_PRIVATE_KEY: ${{ secrets.WX_PRIVATE_KEY }} run: | + # 验证密钥是否为空 + if [ -z "$WX_PRIVATE_KEY" ]; then + echo "❌ 错误: WX_PRIVATE_KEY 为空,请检查 GitHub Secrets 设置" + exit 1 + fi mkdir -p ./build echo "$WX_PRIVATE_KEY" > ./build/key - chmod +x ./build/ci.js - node ./build/ci.js --skip-key-write + echo "$WX_PRIVATE_KEY" | xxd +