fix(ci): 适配 Gitea act_runner,采用原生 docker 登录与构建推送,修正镜像源端口
Build and Push Docker Image / build (push) Failing after 34s

This commit is contained in:
Antigravity committed 2026-09-19 11:39:01 +08:00
1 parent f092dbb3f8
commit f098904ab9
1 file changed
+15 -25
+15 -25
View File
@@ -15,31 +15,21 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea Container Registry
uses: docker/login-action@v3
with:
registry: git.openlocalpdf.com:222
username: ${{ gitea.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.openlocalpdf.com -u "${{ gitea.actor }}" --password-stdin
- name: Extract metadata for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: git.openlocalpdf.com:222/${{ gitea.repository }}
tags: |
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main' }}
type=ref,event=tag
type=sha,format=short
- name: Build and Push Docker image
run: |
IMAGE_NAME="git.openlocalpdf.com/${{ gitea.repository }}"
echo "Building image: ${IMAGE_NAME}:latest"
docker build -t "${IMAGE_NAME}:latest" -f Dockerfile .
docker push "${IMAGE_NAME}:latest"
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
# 如果是 tag 触发,则同步打 tag 推送
if [ "${{ github.ref_type }}" = "tag" ]; then
TAG_NAME="${{ github.ref_name }}"
echo "Tag detected: ${TAG_NAME}"
docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:${TAG_NAME}"
docker push "${IMAGE_NAME}:${TAG_NAME}"
fi