Skip to content

Commit 5247ecb

Browse files
committed
ci: publish gateway image only for release tags
1 parent cfac1d4 commit 5247ecb

2 files changed

Lines changed: 12 additions & 25 deletions

File tree

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,18 @@
11
name: Gateway Docker
22

33
on:
4-
workflow_run:
5-
workflows:
6-
- CI
7-
types:
8-
- completed
94
push:
105
tags:
116
- "v*"
127
workflow_dispatch:
8+
inputs:
9+
tag:
10+
description: Existing release tag to publish, for example v0.1.0
11+
required: true
1312

1413
permissions:
1514
contents: read
1615
packages: write
17-
id-token: write
18-
attestations: write
1916

2017
env:
2118
IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/liveagent-gateway
@@ -24,11 +21,10 @@ jobs:
2421
build-and-push:
2522
name: Build and Push Gateway Image
2623
runs-on: ubuntu-latest
27-
if: github.event_name != 'workflow_run' || (github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.head_branch == 'main')
2824
steps:
2925
- uses: actions/checkout@v4
3026
with:
31-
ref: ${{ github.event.workflow_run.head_sha || github.ref }}
27+
ref: ${{ github.event.inputs.tag || github.ref }}
3228

3329
- uses: docker/setup-qemu-action@v3
3430

@@ -46,13 +42,11 @@ jobs:
4642
uses: docker/metadata-action@v5
4743
with:
4844
images: ${{ env.IMAGE_NAME }}
45+
flavor: |
46+
latest=false
4947
tags: |
50-
type=ref,event=branch,enable=${{ github.event_name != 'workflow_run' }}
51-
type=ref,event=tag,enable=${{ github.event_name != 'workflow_run' }}
52-
type=sha,prefix=sha-,enable=${{ github.event_name != 'workflow_run' }}
53-
type=raw,value=main,enable=${{ github.event_name == 'workflow_run' }}
54-
type=raw,value=sha-${{ github.event.workflow_run.head_sha }},enable=${{ github.event_name == 'workflow_run' }}
55-
type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
48+
type=raw,value=${{ github.event.inputs.tag || github.ref_name }}
49+
type=raw,value=latest
5650
5751
- name: Build and push
5852
id: push
@@ -66,10 +60,4 @@ jobs:
6660
labels: ${{ steps.meta.outputs.labels }}
6761
cache-from: type=gha
6862
cache-to: type=gha,mode=max
69-
70-
- name: Attest image provenance
71-
uses: actions/attest-build-provenance@v2
72-
with:
73-
subject-name: ${{ env.IMAGE_NAME }}
74-
subject-digest: ${{ steps.push.outputs.digest }}
75-
push-to-registry: true
63+
provenance: false

docs/operations/deployment.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77
| 入口 | Workflow | 动作 |
88
|---|---|---|
99
| PR / `main` push | `.github/workflows/ci.yml` | 跑 Gateway、WebUI、GUI、Tauri Rust 测试和 proto 一致性检查。 |
10-
| `main` push 且 CI 成功 | `.github/workflows/gateway-docker.yml` | 构建并推送 `ghcr.io/<owner>/liveagent-gateway:main``sha-*` 镜像。 |
11-
| `v*` tag | `.github/workflows/gateway-docker.yml` | 构建并推送 `vX.Y.Z``latest` Gateway 镜像。 |
10+
| `v*` tag / 手动指定 tag | `.github/workflows/gateway-docker.yml` | 构建并推送 `vX.Y.Z``latest` Gateway 镜像。 |
1211
| `v*` tag | `.github/workflows/desktop-release.yml` | 并行构建 macOS Intel、macOS Apple Silicon 和 Windows x64 桌面包,并上传到 GitHub Release。 |
1312

1413
## Gateway 镜像
@@ -39,7 +38,7 @@ CI 中的 `Gateway Docker Smoke` job 会执行同等检查:构建镜像、启
3938

4039
## 用户自部署 Gateway
4140

42-
LiveAgent 不提供托管 Gateway 服务。需要公网 Remote Gateway 的用户可以用自己的 Railway 账号部署本仓库,或在其他 Docker 平台部署 `ghcr.io/<owner>/liveagent-gateway` 镜像。
41+
LiveAgent 不提供托管 Gateway 服务。需要公网 Remote Gateway 的用户可以用自己的 Railway 账号部署本仓库,或在其他 Docker 平台部署 `ghcr.io/<owner>/liveagent-gateway:vX.Y.Z` / `latest` 镜像。
4342

4443
Railway 自部署路径:
4544

0 commit comments

Comments
 (0)