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 - name: Checkout code
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
uses: docker/login-action@v3 run: |
with: echo "${{ secrets.GITHUB_TOKEN }}" | docker login git.openlocalpdf.com -u "${{ gitea.actor }}" --password-stdin
registry: git.openlocalpdf.com:222
username: ${{ gitea.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata for Docker - name: Build and Push Docker image
id: meta run: |
uses: docker/metadata-action@v5 IMAGE_NAME="git.openlocalpdf.com/${{ gitea.repository }}"
with: echo "Building image: ${IMAGE_NAME}:latest"
images: git.openlocalpdf.com:222/${{ gitea.repository }} docker build -t "${IMAGE_NAME}:latest" -f Dockerfile .
tags: | docker push "${IMAGE_NAME}:latest"
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 # 如果是 tag 触发,则同步打 tag 推送
uses: docker/build-push-action@v5 if [ "${{ github.ref_type }}" = "tag" ]; then
with: TAG_NAME="${{ github.ref_name }}"
context: . echo "Tag detected: ${TAG_NAME}"
file: ./Dockerfile docker tag "${IMAGE_NAME}:latest" "${IMAGE_NAME}:${TAG_NAME}"
push: true docker push "${IMAGE_NAME}:${TAG_NAME}"
tags: ${{ steps.meta.outputs.tags }} fi
labels: ${{ steps.meta.outputs.labels }}