From 3ec3b5539b33388b5c693e112d4e81aba4f6ddc4 Mon Sep 17 00:00:00 2001 From: Misaka Date: Sat, 30 Nov 2024 15:52:54 +0800 Subject: [PATCH] =?UTF-8?q?Add=20=E6=94=AF=E6=8C=81CI=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/origin.yaml | 45 +++++++++++++++++++++++++++++++++++ .github/workflows/task.yaml | 15 ++++++++++++ miniprogram/package.json | 6 +++++ 3 files changed, 66 insertions(+) create mode 100644 .github/workflows/origin.yaml create mode 100644 .github/workflows/task.yaml create mode 100644 miniprogram/package.json diff --git a/.github/workflows/origin.yaml b/.github/workflows/origin.yaml new file mode 100644 index 0000000..baff9d3 --- /dev/null +++ b/.github/workflows/origin.yaml @@ -0,0 +1,45 @@ +name: 构建并上传小程序代码 + +on: + workflow_call: + secrets: + APPID: + required: true + KEY: + required: true + +jobs: + upload: + runs-on: ubuntu-latest + + steps: + - name: 检出代码 + uses: actions/checkout@v4 + with: + repository: misaka-org/Chaoxing-MiniProgram + + - name: 安装 Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 写入私钥 + run: | + cd miniprogram + echo "${{ secrets.KEY }}" > ./private.${{ secrets.APPID }}.key + + - name: 安装依赖 + run: | + cd miniprogram + npm install --omit=dev --no-audit + npm install -g miniprogram-ci + + - name: 构建 NPM + run: | + cd miniprogram + miniprogram-ci pack-npm --pp ./ --pkp ./private.${{ secrets.APPID }}.key --appid ${{ secrets.APPID }} + + - name: 执行小程序编译上传 + run: | + cd miniprogram + miniprogram-ci upload --pp ./ --pkp ./private.${{ secrets.APPID }}.key --appid ${{ secrets.APPID }} --enable-es6 true -r 30 \ No newline at end of file diff --git a/.github/workflows/task.yaml b/.github/workflows/task.yaml new file mode 100644 index 0000000..c313e46 --- /dev/null +++ b/.github/workflows/task.yaml @@ -0,0 +1,15 @@ +name: 执行上传任务 + +on: + push: + branches: + - main + workflow_dispatch: + +jobs: + call_workflow: + uses: misaka-org/Chaoxing-MiniProgram/.github/workflows/origin.yaml@main + secrets: + APPID: ${{ secrets.APPID }} + KEY: ${{ secrets.KEY }} + diff --git a/miniprogram/package.json b/miniprogram/package.json new file mode 100644 index 0000000..fce68c0 --- /dev/null +++ b/miniprogram/package.json @@ -0,0 +1,6 @@ +{ + "dependencies": { + "tdesign-miniprogram": "^1.8.1", + "miniprogram-ci": "^2.0.10" + } +} \ No newline at end of file