This commit is contained in:
@@ -13,10 +13,10 @@ jobs:
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git init -q .
|
||||
git remote add origin "https://token:${GITEA_TOKEN}@git.sundynix.cn/${{ github.repository }}.git"
|
||||
git fetch -q --depth 1 origin "${{ github.ref }}"
|
||||
git checkout -q FETCH_HEAD
|
||||
set -euo pipefail
|
||||
curl -fLsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.sundynix.cn/${{ github.repository }}/archive/${{ github.sha }}.tar.gz" \
|
||||
| tar -xz --strip-components=1
|
||||
|
||||
- name: 测试并构建后端与管理端
|
||||
run: docker build -f pets-be/Dockerfile -t "sundynix/pets-be:ci-${{ github.sha }}" pets-be
|
||||
|
||||
@@ -17,14 +17,15 @@ jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest # 须匹配已注册 runner 的标签
|
||||
steps:
|
||||
# 不用 actions/checkout(它要去 github.com 下载 action,内网 runner 连不上会 EOF);
|
||||
# 直接从内网 Gitea 用工作流自带 token 拉本仓库当前分支。
|
||||
# Gitea 的 Git HTTP pack 当前不可用,改用带 job token 的归档接口检出当前提交。
|
||||
- name: 检出代码(内网 Gitea)
|
||||
env:
|
||||
GITEA_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
git init -q .
|
||||
git remote add origin "https://token:${{ github.token }}@git.sundynix.cn/${{ github.repository }}.git"
|
||||
git fetch -q --depth 1 origin "${{ github.ref_name }}"
|
||||
git checkout -q FETCH_HEAD
|
||||
set -euo pipefail
|
||||
curl -fLsS -H "Authorization: token ${GITEA_TOKEN}" \
|
||||
"https://git.sundynix.cn/${{ github.repository }}/archive/${{ github.sha }}.tar.gz" \
|
||||
| tar -xz --strip-components=1
|
||||
|
||||
# 单镜像:内部先用 node 构建管理后台前端,再 Go 编译内嵌进二进制。
|
||||
# 构建上下文是 pets-be/(go.mod 和 web/admin 都在里面)。
|
||||
|
||||
Reference in New Issue
Block a user