fix: 参考 new-pet 项目修正 Actions 配置
Publish Mini Program Dev Version / publish (push) Waiting to run
Build and Deploy Server / build (push) Waiting to run

- 使用 hk 运行器(空闲状态)
- 添加详细注释说明
- 参考 new-pet 的成熟配置
- 确保只在指定目录变更时触发
This commit is contained in:
gouki
2026-08-06 22:59:56 +00:00
parent 09d8a39946
commit c19854ce77
2 changed files with 14 additions and 6 deletions
+5
View File
@@ -10,10 +10,12 @@ on:
jobs: jobs:
publish: publish:
# 使用 hk 运行器(空闲状态)
runs-on: hk runs-on: hk
steps: steps:
- uses: https://gitea.neatcn.com/gouki/action-checkout@v4 - uses: https://gitea.neatcn.com/gouki/action-checkout@v4
with: with:
# Need recent commit subjects for the WeChat upload remark.
fetch-depth: 20 fetch-depth: 20
- name: Verify Node runtime - name: Verify Node runtime
run: node --version run: node --version
@@ -47,6 +49,7 @@ jobs:
env: env:
MINIAPP_APPID: ${{ vars.MINIAPP_APPID }} MINIAPP_APPID: ${{ vars.MINIAPP_APPID }}
MINIAPP_ROBOT: ${{ vars.MINIAPP_ROBOT }} MINIAPP_ROBOT: ${{ vars.MINIAPP_ROBOT }}
# Prefer the version resolved before build so UI label matches WeChat upload.
MINIAPP_BUILD_NUMBER: ${{ gitea.run_number }} MINIAPP_BUILD_NUMBER: ${{ gitea.run_number }}
MINIAPP_VERSION_OVERRIDE: ${{ vars.MINIAPP_VERSION_OVERRIDE }} MINIAPP_VERSION_OVERRIDE: ${{ vars.MINIAPP_VERSION_OVERRIDE }}
WECHAT_CI_PRIVATE_KEY_PATH: ${{ runner.temp }}/wechat-ci.key WECHAT_CI_PRIVATE_KEY_PATH: ${{ runner.temp }}/wechat-ci.key
@@ -59,11 +62,13 @@ jobs:
test -n "$MINIAPP_BUILD_NUMBER" test -n "$MINIAPP_BUILD_NUMBER"
test -s ci-artifacts/resolved-version.txt test -s ci-artifacts/resolved-version.txt
RESOLVED_VERSION="$(tr -d '\n' < ci-artifacts/resolved-version.txt)" RESOLVED_VERSION="$(tr -d '\n' < ci-artifacts/resolved-version.txt)"
# Force upload to the same version that was baked into the JS bundle.
export MINIAPP_VERSION_OVERRIDE="$RESOLVED_VERSION" export MINIAPP_VERSION_OVERRIDE="$RESOLVED_VERSION"
mkdir -p ci-artifacts mkdir -p ci-artifacts
node -e 'const c=require("./project.config.json"); if(c.appid!==process.env.MINIAPP_APPID){console.error("MINIAPP_APPID mismatch with project.config.json", process.env.MINIAPP_APPID, c.appid); process.exit(1)}' node -e 'const c=require("./project.config.json"); if(c.appid!==process.env.MINIAPP_APPID){console.error("MINIAPP_APPID mismatch with project.config.json", process.env.MINIAPP_APPID, c.appid); process.exit(1)}'
node -e 'const {resolveVersion}=require("./ci/resolve-version.cjs"); console.log("Resolved Mini Program version:", resolveVersion(process.cwd()))' node -e 'const {resolveVersion}=require("./ci/resolve-version.cjs"); console.log("Resolved Mini Program version:", resolveVersion(process.cwd()))'
node -e 'const {resolveUploadDesc}=require("./ci/resolve-upload-desc.cjs"); console.log("Resolved upload remark:", resolveUploadDesc({repoRoot:require("path").resolve(".."), versionLabel:process.env.MINIAPP_VERSION_LABEL}))' node -e 'const {resolveUploadDesc}=require("./ci/resolve-upload-desc.cjs"); console.log("Resolved upload remark:", resolveUploadDesc({repoRoot:require("path").resolve(".."), versionLabel:process.env.MINIAPP_VERSION_LABEL}))'
# Normalize PEM newlines that may be flattened when stored in Secrets.
python3 - <<'PY' python3 - <<'PY'
from pathlib import Path from pathlib import Path
import os import os
+9 -6
View File
@@ -10,6 +10,7 @@ on:
jobs: jobs:
build: build:
# 使用 hk 运行器(空闲状态)
runs-on: hk runs-on: hk
steps: steps:
- uses: https://gitea.neatcn.com/gouki/action-checkout@v4 - uses: https://gitea.neatcn.com/gouki/action-checkout@v4
@@ -64,12 +65,14 @@ jobs:
fi fi
tar -czf deploy.tar.gz deploy/ tar -czf deploy.tar.gz deploy/
- name: Upload deployment artifact - name: Persist deployment package on runner host
uses: https://gitea.neatcn.com/gouki/action-upload-artifact@v3 run: |
with: test -f server/deploy.tar.gz
name: server-deploy test -d /ci-artifacts
path: server/deploy.tar.gz cp server/deploy.tar.gz "/ci-artifacts/server-deploy-${{ gitea.sha }}.tar.gz"
retention-days: 7 cp server/deploy.tar.gz /ci-artifacts/server-deploy-latest.tar.gz
ls -la /ci-artifacts/server-deploy-latest.tar.gz
echo "Deployment package saved on runner host: /ci-artifacts/server-deploy-latest.tar.gz"
- name: Cleanup - name: Cleanup
if: always() if: always()