From 970d62c5e42ee348ebcf92fcc3720241ed09fee1 Mon Sep 17 00:00:00 2001 From: Misaka Date: Sat, 30 Nov 2024 15:40:08 +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 | 40 +++++++++++++++++++++++++++++++++++ .github/workflows/task.yaml | 15 +++++++++++++ miniprogram/package.json | 6 ++++++ 3 files changed, 61 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..afb20fa --- /dev/null +++ b/.github/workflows/origin.yaml @@ -0,0 +1,40 @@ +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 + + - name: 写入私钥 + run: echo "${{ secrets.KEY }}" > ./private.${{ secrets.APPID }}.key + + - name: 安装依赖 + run: | + npm install --omit=dev --no-audit + npm install -g miniprogram-ci + + - name: 执行小程序构建 + run: | + miniprogram-ci pack-npm --pp ./ --pkp ./private.${{ secrets.APPID }}.key --appid ${{ secrets.APPID }} + 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