ci: 添加 Gitea Actions 自动构建 Docker 镜像工作流

This commit is contained in:
Antigravity committed 2026-09-19 11:21:40 +08:00
1 parent b3b4c5d7e8
commit 1e4b4979bf
3 files changed
+55

No files matched your search

+45
View File
@@ -0,0 +1,45 @@
name: Build and Push Docker Image
on:
push:
branches:
- master
- main
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- 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 }}
- 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
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}