This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
#
|
||||
# 说明:NODEJS_ORG_MIRROR 在 act_runner 中常被忽略/不生效;用镜像自带 Node 即可绕过。
|
||||
#
|
||||
# 不依赖 GitHub:不使用 actions/checkout、actions/cache,仅从当前 Gitea 实例 git fetch(需 Runner 能访问 Gitea)。
|
||||
#
|
||||
# 部署(推送到 main/master 时):在仓库「工作流 → 密钥」中配置
|
||||
# SSH_PRIVATE_KEY DEPLOY_HOST DEPLOY_USER DEPLOY_PATH
|
||||
# DEPLOY_PATH 为站点父目录;实际发布目录为 ${DEPLOY_PATH}/chat.alboped.com(与 Nginx root 一致)。
|
||||
@@ -26,8 +28,35 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
# 从本 Gitea 拉代码(github.* 为 Actions 兼容上下文;token 由 Gitea 注入)
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
env:
|
||||
TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -e
|
||||
export GIT_TERMINAL_PROMPT=0
|
||||
if ! command -v git >/dev/null 2>&1; then
|
||||
export DEBIAN_FRONTEND=noninteractive
|
||||
shopt -s nullglob
|
||||
for f in /etc/apt/sources.list /etc/apt/sources.list.d/debian.sources /etc/apt/sources.list.d/*.sources /etc/apt/sources.list.d/*.list; do
|
||||
[ -f "$f" ] || continue
|
||||
sed -i \
|
||||
-e 's/deb.debian.org/mirrors.aliyun.com/g' \
|
||||
-e 's/security.debian.org/mirrors.aliyun.com/g' \
|
||||
"$f"
|
||||
done
|
||||
apt-get -o Acquire::http::Timeout=30 -o Acquire::https::Timeout=30 -o Acquire::Retries=2 update
|
||||
apt-get install -y --no-install-recommends git
|
||||
fi
|
||||
SERVER="${{ github.server_url }}"
|
||||
SERVER="${SERVER%/}"
|
||||
REPO="${{ github.repository }}"
|
||||
ORIGIN="${SERVER/https:\/\//https:\/\/oauth2:${TOKEN}@}"
|
||||
ORIGIN="${ORIGIN/http:\/\//http:\/\/oauth2:${TOKEN}@}/${REPO}.git"
|
||||
git init
|
||||
git remote add origin "$ORIGIN"
|
||||
git fetch --depth 1 origin "${{ github.sha }}"
|
||||
git checkout -f "${{ github.sha }}"
|
||||
|
||||
# 使用 Job 镜像(node:22-bookworm)自带的 Node,不再使用 actions/setup-node,避免重复下载 Node
|
||||
- name: Setup Yarn
|
||||
@@ -37,14 +66,6 @@ jobs:
|
||||
echo "node -v: $(node -v); yarn -v: $(yarn -v)"
|
||||
echo "yarn config get registry: $(yarn config get registry)"
|
||||
|
||||
- name: Cache Yarn
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.cache/yarn
|
||||
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-yarn-
|
||||
|
||||
- name: Install
|
||||
run: yarn install --frozen-lockfile
|
||||
|
||||
|
||||
Reference in New Issue
Block a user