Files
Prism/.gitea/workflows/ci.yml
T
rose_cat707 024c15a836
CI / test (push) Has been cancelled
CI / docker (push) Has been cancelled
feat: Prism HTTP/SOCKS5 代理网关及管理台
Go 控制面(SQLite + REST API)嵌入 Mihomo 数据面,Vue 3 多语言 Web 管理台。
含订阅/节点/规则/出站/监控/日志、OpenAPI、API Key、Gitea Actions CI 与开源文档。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 12:18:58 +08:00

88 lines
2.3 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Prism CI:单元测试 + 多架构镜像发布到 Gitea Container Registry
#
# 前置条件(仓库 Settings → Secrets → Actions):
# REGISTRY_TOKEN 具有 write:package 权限的 Personal Access Token
#
# 镜像命名:{REGISTRY}/{owner}/prism:{tag}
# 默认 REGISTRY=git.rc707blog.topGitea 实例域名,Container Registry 与代码仓库同域)
name: CI
on:
push:
branches: [main, master]
tags: ['v*']
pull_request:
env:
REGISTRY: git.rc707blog.top
IMAGE_NAME: prism
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
cache: true
- name: Run tests
run: go test ./...
docker:
runs-on: ubuntu-latest
needs: test
if: gitea.event_name == 'push'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- 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: ${{ env.REGISTRY }}
username: ${{ gitea.actor }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Resolve image tags
id: meta
run: |
image="${REGISTRY}/${GITEA_REPOSITORY_OWNER}/${IMAGE_NAME}"
tags="${image}:sha-${GITEA_SHA:0:7}"
case "${GITEA_REF}" in
refs/heads/main|refs/heads/master)
tags="${tags},${image}:latest"
;;
refs/tags/v*)
tag="${GITEA_REF#refs/tags/}"
tags="${tags},${image}:${tag}"
;;
esac
echo "tags=${tags}" >> "${GITHUB_OUTPUT}"
env:
REGISTRY: ${{ env.REGISTRY }}
IMAGE_NAME: ${{ env.IMAGE_NAME }}
GITEA_SHA: ${{ gitea.sha }}
GITEA_REF: ${{ gitea.ref }}
GITEA_REPOSITORY_OWNER: ${{ gitea.repository_owner }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}