2025-12-18 13:50:39 +08:00
|
|
|
|
version: 2
|
|
|
|
|
|
|
|
|
|
|
|
project_name: sub2api
|
|
|
|
|
|
|
|
|
|
|
|
before:
|
|
|
|
|
|
hooks:
|
|
|
|
|
|
- go mod tidy -C backend
|
|
|
|
|
|
|
|
|
|
|
|
builds:
|
|
|
|
|
|
- id: sub2api
|
|
|
|
|
|
dir: backend
|
|
|
|
|
|
main: ./cmd/server
|
|
|
|
|
|
binary: sub2api
|
2025-12-20 19:13:26 +08:00
|
|
|
|
flags:
|
|
|
|
|
|
- -tags=embed
|
2025-12-18 13:50:39 +08:00
|
|
|
|
env:
|
|
|
|
|
|
- CGO_ENABLED=0
|
|
|
|
|
|
goos:
|
|
|
|
|
|
- linux
|
|
|
|
|
|
- windows
|
|
|
|
|
|
- darwin
|
|
|
|
|
|
goarch:
|
|
|
|
|
|
- amd64
|
|
|
|
|
|
- arm64
|
|
|
|
|
|
ignore:
|
|
|
|
|
|
- goos: windows
|
|
|
|
|
|
goarch: arm64
|
|
|
|
|
|
ldflags:
|
|
|
|
|
|
- -s -w
|
|
|
|
|
|
- -X main.Commit={{.Commit}}
|
|
|
|
|
|
- -X main.Date={{.Date}}
|
|
|
|
|
|
- -X main.BuildType=release
|
|
|
|
|
|
|
|
|
|
|
|
archives:
|
|
|
|
|
|
- id: default
|
|
|
|
|
|
format: tar.gz
|
|
|
|
|
|
name_template: >-
|
|
|
|
|
|
{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}
|
|
|
|
|
|
format_overrides:
|
|
|
|
|
|
- goos: windows
|
|
|
|
|
|
format: zip
|
|
|
|
|
|
files:
|
|
|
|
|
|
- LICENSE*
|
|
|
|
|
|
- README*
|
|
|
|
|
|
- deploy/*
|
|
|
|
|
|
|
|
|
|
|
|
checksum:
|
|
|
|
|
|
name_template: 'checksums.txt'
|
|
|
|
|
|
algorithm: sha256
|
|
|
|
|
|
|
|
|
|
|
|
changelog:
|
|
|
|
|
|
# 禁用自动 changelog,完全使用 tag 消息
|
|
|
|
|
|
disable: true
|
|
|
|
|
|
|
2025-12-25 14:47:19 +08:00
|
|
|
|
# Docker images
|
|
|
|
|
|
dockers:
|
2026-01-02 18:04:11 +08:00
|
|
|
|
# DockerHub images (skipped if DOCKERHUB_USERNAME is 'skip')
|
2025-12-25 14:47:19 +08:00
|
|
|
|
- id: amd64
|
|
|
|
|
|
goos: linux
|
|
|
|
|
|
goarch: amd64
|
2026-01-02 18:04:11 +08:00
|
|
|
|
skip_push: '{{ if eq .Env.DOCKERHUB_USERNAME "skip" }}true{{ else }}false{{ end }}'
|
2025-12-25 14:47:19 +08:00
|
|
|
|
image_templates:
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
dockerfile: Dockerfile.goreleaser
|
|
|
|
|
|
use: buildx
|
2026-03-16 19:52:14 +08:00
|
|
|
|
extra_files:
|
|
|
|
|
|
- deploy/docker-entrypoint.sh
|
2025-12-25 14:47:19 +08:00
|
|
|
|
build_flag_templates:
|
|
|
|
|
|
- "--platform=linux/amd64"
|
|
|
|
|
|
- "--label=org.opencontainers.image.version={{ .Version }}"
|
|
|
|
|
|
- "--label=org.opencontainers.image.revision={{ .Commit }}"
|
|
|
|
|
|
|
|
|
|
|
|
- id: arm64
|
|
|
|
|
|
goos: linux
|
|
|
|
|
|
goarch: arm64
|
2026-01-02 18:04:11 +08:00
|
|
|
|
skip_push: '{{ if eq .Env.DOCKERHUB_USERNAME "skip" }}true{{ else }}false{{ end }}'
|
2025-12-25 14:47:19 +08:00
|
|
|
|
image_templates:
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-arm64"
|
|
|
|
|
|
dockerfile: Dockerfile.goreleaser
|
|
|
|
|
|
use: buildx
|
2026-03-16 19:52:14 +08:00
|
|
|
|
extra_files:
|
|
|
|
|
|
- deploy/docker-entrypoint.sh
|
2025-12-25 14:47:19 +08:00
|
|
|
|
build_flag_templates:
|
|
|
|
|
|
- "--platform=linux/arm64"
|
|
|
|
|
|
- "--label=org.opencontainers.image.version={{ .Version }}"
|
|
|
|
|
|
- "--label=org.opencontainers.image.revision={{ .Commit }}"
|
|
|
|
|
|
|
2025-12-31 17:12:09 +08:00
|
|
|
|
# GHCR images (owner must be lowercase)
|
2025-12-31 14:21:40 +08:00
|
|
|
|
- id: ghcr-amd64
|
|
|
|
|
|
goos: linux
|
|
|
|
|
|
goarch: amd64
|
|
|
|
|
|
image_templates:
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-amd64"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
dockerfile: Dockerfile.goreleaser
|
|
|
|
|
|
use: buildx
|
2026-03-16 19:52:14 +08:00
|
|
|
|
extra_files:
|
|
|
|
|
|
- deploy/docker-entrypoint.sh
|
2025-12-31 14:21:40 +08:00
|
|
|
|
build_flag_templates:
|
|
|
|
|
|
- "--platform=linux/amd64"
|
|
|
|
|
|
- "--label=org.opencontainers.image.version={{ .Version }}"
|
|
|
|
|
|
- "--label=org.opencontainers.image.revision={{ .Commit }}"
|
|
|
|
|
|
- "--label=org.opencontainers.image.source=https://github.com/{{ .Env.GITHUB_REPO_OWNER }}/{{ .Env.GITHUB_REPO_NAME }}"
|
|
|
|
|
|
|
|
|
|
|
|
- id: ghcr-arm64
|
|
|
|
|
|
goos: linux
|
|
|
|
|
|
goarch: arm64
|
|
|
|
|
|
image_templates:
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-arm64"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
dockerfile: Dockerfile.goreleaser
|
|
|
|
|
|
use: buildx
|
2026-03-16 19:52:14 +08:00
|
|
|
|
extra_files:
|
|
|
|
|
|
- deploy/docker-entrypoint.sh
|
2025-12-31 14:21:40 +08:00
|
|
|
|
build_flag_templates:
|
|
|
|
|
|
- "--platform=linux/arm64"
|
|
|
|
|
|
- "--label=org.opencontainers.image.version={{ .Version }}"
|
|
|
|
|
|
- "--label=org.opencontainers.image.revision={{ .Commit }}"
|
|
|
|
|
|
- "--label=org.opencontainers.image.source=https://github.com/{{ .Env.GITHUB_REPO_OWNER }}/{{ .Env.GITHUB_REPO_NAME }}"
|
|
|
|
|
|
|
2025-12-25 14:47:19 +08:00
|
|
|
|
# Docker manifests for multi-arch support
|
|
|
|
|
|
docker_manifests:
|
2026-01-02 18:04:11 +08:00
|
|
|
|
# DockerHub manifests (skipped if DOCKERHUB_USERNAME is 'skip')
|
2025-12-25 14:47:19 +08:00
|
|
|
|
- name_template: "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}"
|
2026-01-02 18:04:11 +08:00
|
|
|
|
skip_push: '{{ if eq .Env.DOCKERHUB_USERNAME "skip" }}true{{ else }}false{{ end }}'
|
2025-12-25 14:47:19 +08:00
|
|
|
|
image_templates:
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-arm64"
|
|
|
|
|
|
|
|
|
|
|
|
- name_template: "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:latest"
|
2026-01-02 18:04:11 +08:00
|
|
|
|
skip_push: '{{ if eq .Env.DOCKERHUB_USERNAME "skip" }}true{{ else }}false{{ end }}'
|
2025-12-25 14:47:19 +08:00
|
|
|
|
image_templates:
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-arm64"
|
|
|
|
|
|
|
|
|
|
|
|
- name_template: "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Major }}.{{ .Minor }}"
|
2026-01-02 18:04:11 +08:00
|
|
|
|
skip_push: '{{ if eq .Env.DOCKERHUB_USERNAME "skip" }}true{{ else }}false{{ end }}'
|
2025-12-25 14:47:19 +08:00
|
|
|
|
image_templates:
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-arm64"
|
|
|
|
|
|
|
|
|
|
|
|
- name_template: "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Major }}"
|
2026-01-02 18:04:11 +08:00
|
|
|
|
skip_push: '{{ if eq .Env.DOCKERHUB_USERNAME "skip" }}true{{ else }}false{{ end }}'
|
2025-12-25 14:47:19 +08:00
|
|
|
|
image_templates:
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "{{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}-arm64"
|
|
|
|
|
|
|
2025-12-31 17:12:09 +08:00
|
|
|
|
# GHCR manifests (owner must be lowercase)
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- name_template: "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
image_templates:
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-arm64"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- name_template: "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:latest"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
image_templates:
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-arm64"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- name_template: "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Major }}.{{ .Minor }}"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
image_templates:
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-arm64"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- name_template: "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Major }}"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
image_templates:
|
2025-12-31 17:25:43 +08:00
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-amd64"
|
|
|
|
|
|
- "ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}-arm64"
|
2025-12-31 14:21:40 +08:00
|
|
|
|
|
2025-12-18 13:50:39 +08:00
|
|
|
|
release:
|
|
|
|
|
|
github:
|
2025-12-25 14:47:19 +08:00
|
|
|
|
owner: "{{ .Env.GITHUB_REPO_OWNER }}"
|
|
|
|
|
|
name: "{{ .Env.GITHUB_REPO_NAME }}"
|
2025-12-18 13:50:39 +08:00
|
|
|
|
draft: false
|
|
|
|
|
|
prerelease: auto
|
2025-12-18 15:30:35 +08:00
|
|
|
|
name_template: "Sub2API {{.Version}}"
|
|
|
|
|
|
# 完全使用 tag 消息作为 release 内容(通过环境变量传入)
|
2025-12-18 13:50:39 +08:00
|
|
|
|
header: |
|
|
|
|
|
|
> AI API Gateway Platform - 将 AI 订阅配额分发和管理
|
|
|
|
|
|
|
2025-12-18 15:30:35 +08:00
|
|
|
|
{{ .Env.TAG_MESSAGE }}
|
2025-12-18 13:50:39 +08:00
|
|
|
|
|
|
|
|
|
|
footer: |
|
|
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
|
|
## 📥 Installation
|
|
|
|
|
|
|
2025-12-31 14:21:40 +08:00
|
|
|
|
**Docker:**
|
|
|
|
|
|
```bash
|
2026-01-02 18:04:11 +08:00
|
|
|
|
{{ if ne .Env.DOCKERHUB_USERNAME "skip" -}}
|
2025-12-31 14:21:40 +08:00
|
|
|
|
# Docker Hub
|
|
|
|
|
|
docker pull {{ .Env.DOCKERHUB_USERNAME }}/sub2api:{{ .Version }}
|
|
|
|
|
|
|
2026-01-02 18:04:11 +08:00
|
|
|
|
{{ end -}}
|
2025-12-31 14:21:40 +08:00
|
|
|
|
# GitHub Container Registry
|
2025-12-31 17:25:43 +08:00
|
|
|
|
docker pull ghcr.io/{{ .Env.GITHUB_REPO_OWNER_LOWER }}/sub2api:{{ .Version }}
|
2025-12-31 14:21:40 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
2025-12-18 13:50:39 +08:00
|
|
|
|
**One-line install (Linux):**
|
|
|
|
|
|
```bash
|
2025-12-25 14:47:19 +08:00
|
|
|
|
curl -sSL https://raw.githubusercontent.com/{{ .Env.GITHUB_REPO_OWNER }}/{{ .Env.GITHUB_REPO_NAME }}/main/deploy/install.sh | sudo bash
|
2025-12-18 13:50:39 +08:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
**Manual download:**
|
|
|
|
|
|
Download the appropriate archive for your platform from the assets below.
|
|
|
|
|
|
|
|
|
|
|
|
## 📚 Documentation
|
|
|
|
|
|
|
2025-12-25 14:47:19 +08:00
|
|
|
|
- [GitHub Repository](https://github.com/{{ .Env.GITHUB_REPO_OWNER }}/{{ .Env.GITHUB_REPO_NAME }})
|
|
|
|
|
|
- [Installation Guide](https://github.com/{{ .Env.GITHUB_REPO_OWNER }}/{{ .Env.GITHUB_REPO_NAME }}/blob/main/deploy/README.md)
|