From 1e4b4979bfe1c7f8bea0640339d54dae7ffefd3e Mon Sep 17 00:00:00 2001 From: Antigravity Date: Sat, 19 Sep 2026 11:21:40 +0800 Subject: [PATCH] =?UTF-8?q?ci:=20=E6=B7=BB=E5=8A=A0=20Gitea=20Actions=20?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E6=9E=84=E5=BB=BA=20Docker=20=E9=95=9C?= =?UTF-8?q?=E5=83=8F=E5=B7=A5=E4=BD=9C=E6=B5=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/build.yaml | 45 +++++++++++++++++++++++++++++++++++++ .gitignore | 1 + README.md | 9 ++++++++ 3 files changed, 55 insertions(+) create mode 100644 .gitea/workflows/build.yaml diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml new file mode 100644 index 0000000..b9d6f8b --- /dev/null +++ b/.gitea/workflows/build.yaml @@ -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 }} diff --git a/.gitignore b/.gitignore index 71c5423..87d39a2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store Thumbs.db *.log +.codegraph/ diff --git a/README.md b/README.md index 453098b..7536a80 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,15 @@ ## 构建方法 +### 本地构建 + ```bash docker build -t webman:8.2 . ``` + +### Gitea CI/CD 自动构建 + +已配置 `.gitea/workflows/build.yaml`。每次推送到 `master` / `main` 或推送 tag(如 `v1.0.0`)时,Gitea Actions 会自动构建并推送到 Gitea 镜像仓库: + +- **Registry**: `git.openlocalpdf.com:222/gitea/webman-docker:latest` +- 确保 Gitea 仓库已启用 Actions 且部署有对应 Runner(如 act_runner)。