fix: checkout 后显式 git fetch 切换触发分支,避免始终部署 main 代码;Dockerfile 添加 BuildKit cache mount 加速构建

This commit is contained in:
hhs
2026-06-20 17:43:32 +08:00
parent 6bb4773e07
commit 12e2d24f37
3 changed files with 28 additions and 7 deletions

View File

@@ -10,12 +10,19 @@ jobs:
steps:
- name: Checkout
uses: "http://8.161.227.145:3000/huanghaosheng/checkout@releases/v4"
with:
ref: ${{ github.ref }}
- name: Install Docker CLI
run: apk add --no-cache docker-cli docker-cli-compose rsync
- name: Switch to trigger branch
run: |
git config --global --add safe.directory "$(pwd)"
echo "触发分支: ${GITHUB_REF_NAME}"
git fetch origin "${GITHUB_REF_NAME}" --depth=1
git checkout "${GITHUB_REF_NAME}"
git reset --hard "origin/${GITHUB_REF_NAME}"
echo "当前提交: $(git log -1 --oneline)"
- name: Sync to deploy directory
run: |
mkdir -p /root/camtalk