diff --git a/.gitea/workflows/miniapp-preview.yml b/.gitea/workflows/miniapp-preview.yml index 077b296..cbe2c5c 100644 --- a/.gitea/workflows/miniapp-preview.yml +++ b/.gitea/workflows/miniapp-preview.yml @@ -10,10 +10,12 @@ on: jobs: publish: + # 使用 hk 运行器(空闲状态) runs-on: hk steps: - uses: https://gitea.neatcn.com/gouki/action-checkout@v4 with: + # Need recent commit subjects for the WeChat upload remark. fetch-depth: 20 - name: Verify Node runtime run: node --version @@ -47,6 +49,7 @@ jobs: env: MINIAPP_APPID: ${{ vars.MINIAPP_APPID }} MINIAPP_ROBOT: ${{ vars.MINIAPP_ROBOT }} + # Prefer the version resolved before build so UI label matches WeChat upload. MINIAPP_BUILD_NUMBER: ${{ gitea.run_number }} MINIAPP_VERSION_OVERRIDE: ${{ vars.MINIAPP_VERSION_OVERRIDE }} WECHAT_CI_PRIVATE_KEY_PATH: ${{ runner.temp }}/wechat-ci.key @@ -59,11 +62,13 @@ jobs: test -n "$MINIAPP_BUILD_NUMBER" test -s 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" 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 {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}))' + # Normalize PEM newlines that may be flattened when stored in Secrets. python3 - <<'PY' from pathlib import Path import os diff --git a/.gitea/workflows/server-deploy.yml b/.gitea/workflows/server-deploy.yml index 830dd92..257797e 100644 --- a/.gitea/workflows/server-deploy.yml +++ b/.gitea/workflows/server-deploy.yml @@ -10,6 +10,7 @@ on: jobs: build: + # 使用 hk 运行器(空闲状态) runs-on: hk steps: - uses: https://gitea.neatcn.com/gouki/action-checkout@v4 @@ -64,12 +65,14 @@ jobs: fi tar -czf deploy.tar.gz deploy/ - - name: Upload deployment artifact - uses: https://gitea.neatcn.com/gouki/action-upload-artifact@v3 - with: - name: server-deploy - path: server/deploy.tar.gz - retention-days: 7 + - name: Persist deployment package on runner host + run: | + test -f server/deploy.tar.gz + test -d /ci-artifacts + cp server/deploy.tar.gz "/ci-artifacts/server-deploy-${{ gitea.sha }}.tar.gz" + 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 if: always()