调整流水线

This commit is contained in:
2026-04-16 13:29:45 +08:00
parent 0bb6707e68
commit 8154de452b

View File

@@ -3,6 +3,7 @@
#
# Node请在 Runner 上预装 Node 20+(勿用 actions/setup-node避免每次从 GitHub 拉包)。
# npm通过 npm_registry 输入使用国内镜像(默认 npmmirror
# Checkout不用 actions/checkouthost 模式下 JS Action 仍会进无 Node 的容器);改用 git + github.token。
name: Reusable Frontend Deploy
@@ -41,7 +42,27 @@ jobs:
NPM_CONFIG_REGISTRY: ${{ inputs.npm_registry }}
steps:
- name: Checkout
uses: https://git.jc2009.com/admin/actions-checkout@v4
env:
GITEA_HOST: git.jc2009.com
GITEA_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
git config --global --add safe.directory '*'
REPO="${{ github.repository }}"
SHA="${{ github.sha }}"
URL="https://x-access-token:${GITEA_TOKEN}@${GITEA_HOST}/${REPO}.git"
WS="${GITHUB_WORKSPACE:-$(pwd)}"
cd "$WS"
if [ -d .git ]; then
git remote set-url origin "$URL" || { git remote remove origin 2>/dev/null || true; git remote add origin "$URL"; }
else
shopt -s dotglob nullglob || true
rm -rf ./* ./.??* 2>/dev/null || true
git init
git remote add origin "$URL"
fi
git fetch --depth 1 origin "$SHA"
git checkout --force FETCH_HEAD
- name: Check Node.js (pre-installed on runner)
run: |