Skip to content

Commit 4525637

Browse files
author
cyk
committed
ci(docker): auto-trigger on feat/dynamic-frontend + per-variant image names
Two changes that go together because the second was useless without the first. Push to feat/dynamic-frontend (the active branch) was not in the trigger list, so commits like Fix 3 b80688c never produced a fresh :front-rolling image -- the user kept pulling stale binaries and the mpv "Failed to recognize file format" symptom appeared unfixed when in fact CI had simply not run. - Replace push:main + pull_request:copy triggers with push:feat/dynamic-frontend so every commit on the active branch rebuilds the four docker variants. - Drop the shared IMAGE_NAME env and give each matrix row its own image_name: openlist, openlist-ffmpeg, openlist-aria2, openlist-aio. Tags collapse from openlist:front-rolling-{variant} to {image_name}:front-rolling, so the pull path matches the image intent (ghcr.io/.../openlist-aio:front-rolling, etc.). - :latest now applies to each image when its frontend_channel is "latest", rather than only openlist:latest. - Build cache key reuses the per-variant image_name so caches don't collide across variants.
1 parent 2648349 commit 4525637

1 file changed

Lines changed: 11 additions & 15 deletions

File tree

.github/workflows/test_docker.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ on:
1818
- both
1919
push:
2020
branches:
21-
- main
22-
pull_request:
23-
branches:
24-
- copy
21+
- feat/dynamic-frontend
2522

2623

2724
concurrency:
@@ -32,7 +29,6 @@ env:
3229
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
3330
GHCR_ORG_NAME: ${{ vars.GHCR_ORG_NAME || 'ironboxplus' }} # 👈 最好改成你的用户名,防止推错地方
3431
FRONTEND_REPO: ${{ github.event.inputs.frontend_repo || vars.FRONTEND_REPO || 'OpenListTeam/OpenList-Frontend' }}
35-
IMAGE_NAME: openlist
3632
REGISTRY: ghcr.io
3733
ARTIFACT_NAME_PREFIX: 'binaries_docker_release'
3834
# 👇 关键修改:只保留 linux/amd64,删掉后面一长串
@@ -131,27 +127,27 @@ jobs:
131127
strategy:
132128
matrix:
133129
frontend_channel: ${{ github.event_name == 'workflow_dispatch' && (github.event.inputs.frontend_channel == 'both' && fromJSON('["rolling","latest"]') || fromJSON(format('["{0}"]', github.event.inputs.frontend_channel))) || fromJSON('["latest","rolling"]') }}
134-
# 构建所有变体
130+
# 四种变体,各自独立 image 名(推送到独立 GHCR repo)
135131
image: ["latest", "ffmpeg", "aria2", "aio"]
136132
include:
137133
- image: "latest"
138134
base_image_tag: "base"
139135
build_arg: ""
140-
image_tag_suffix: ""
136+
image_name: "openlist"
141137
- image: "ffmpeg"
142138
base_image_tag: "ffmpeg"
143139
build_arg: INSTALL_FFMPEG=true
144-
image_tag_suffix: "-ffmpeg"
140+
image_name: "openlist-ffmpeg"
145141
- image: "aria2"
146142
base_image_tag: "aria2"
147143
build_arg: INSTALL_ARIA2=true
148-
image_tag_suffix: "-aria2"
144+
image_name: "openlist-aria2"
149145
- image: "aio"
150146
base_image_tag: "aio"
151147
build_arg: |
152148
INSTALL_FFMPEG=true
153149
INSTALL_ARIA2=true
154-
image_tag_suffix: "-aio"
150+
image_name: "openlist-aio"
155151
steps:
156152
- name: Checkout
157153
uses: actions/checkout@v6
@@ -175,10 +171,10 @@ jobs:
175171
uses: docker/metadata-action@v5
176172
with:
177173
images: |
178-
${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}
174+
${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ matrix.image_name }}
179175
tags: |
180-
type=raw,value=front-${{ matrix.frontend_channel }}${{ matrix.image_tag_suffix }}
181-
type=raw,value=latest,enable=${{ matrix.frontend_channel == 'latest' && matrix.image == 'latest' }}
176+
type=raw,value=front-${{ matrix.frontend_channel }}
177+
type=raw,value=latest,enable=${{ matrix.frontend_channel == 'latest' }}
182178
183179
- name: Build and push
184180
uses: docker/build-push-action@v6
@@ -192,5 +188,5 @@ jobs:
192188
tags: ${{ steps.meta.outputs.tags }}
193189
labels: ${{ steps.meta.outputs.labels }}
194190
platforms: ${{ env.RELEASE_PLATFORMS }}
195-
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}:buildcache-front-${{ matrix.frontend_channel }}-${{ matrix.image }}
196-
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ env.IMAGE_NAME }}:buildcache-front-${{ matrix.frontend_channel }}-${{ matrix.image }},mode=max
191+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ matrix.image_name }}:buildcache-front-${{ matrix.frontend_channel }}
192+
cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.GHCR_ORG_NAME }}/${{ matrix.image_name }}:buildcache-front-${{ matrix.frontend_channel }},mode=max

0 commit comments

Comments
 (0)