调整流水线
This commit is contained in:
23
.github/workflows/reusable-release-frontend.yaml
vendored
23
.github/workflows/reusable-release-frontend.yaml
vendored
@@ -3,6 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Node:请在 Runner 上预装 Node 20+(勿用 actions/setup-node,避免每次从 GitHub 拉包)。
|
# Node:请在 Runner 上预装 Node 20+(勿用 actions/setup-node,避免每次从 GitHub 拉包)。
|
||||||
# npm:通过 npm_registry 输入使用国内镜像(默认 npmmirror)。
|
# npm:通过 npm_registry 输入使用国内镜像(默认 npmmirror)。
|
||||||
|
# Checkout:不用 actions/checkout(host 模式下 JS Action 仍会进无 Node 的容器);改用 git + github.token。
|
||||||
|
|
||||||
name: Reusable Frontend Deploy
|
name: Reusable Frontend Deploy
|
||||||
|
|
||||||
@@ -41,7 +42,27 @@ jobs:
|
|||||||
NPM_CONFIG_REGISTRY: ${{ inputs.npm_registry }}
|
NPM_CONFIG_REGISTRY: ${{ inputs.npm_registry }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- 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)
|
- name: Check Node.js (pre-installed on runner)
|
||||||
run: |
|
run: |
|
||||||
|
|||||||
Reference in New Issue
Block a user