From 39222bdcd83a1d7dc929a19fb73c8407caf3c258 Mon Sep 17 00:00:00 2001 From: samanhappy Date: Fri, 18 Apr 2025 20:01:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20update=20build=20workflow=20to=20improve?= =?UTF-8?q?=20cache=20configuration=20and=20image=20n=E2=80=A6=20(#22)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ce2117f..e8d4297 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -37,23 +37,26 @@ jobs: # latest type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} - - name: Build and Push Docker Image + - name: Build and Push Base Docker Image uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max,scope=base + cache-from: type=gha,scope=base-cache + cache-to: type=gha,mode=max,scope=base-cache platforms: linux/amd64,linux/arm64 build-args: | INSTALL_EXT=false + # 确保构建完全独立,不共享缓存或中间层 + provenance: false + no-cache: true build-full: - needs: build-base # 确保在 base 变体完成后再构建 full 变体 + needs: build-base runs-on: ubuntu-latest - if: ${{ startsWith(github.ref, 'refs/tags/') }} # 只在发布标签时构建 full 变体 + if: ${{ startsWith(github.ref, 'refs/tags/') }} steps: - uses: actions/checkout@v4 with: @@ -80,18 +83,18 @@ jobs: # latest-full type=raw,value=latest-full,enable=${{ startsWith(github.ref, 'refs/tags/') }} - # edge-full - type=raw,value=edge-full,enable=${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} - - - name: Build and Push Docker Image + - name: Build and Push Full Docker Image uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=gha - cache-to: type=gha,mode=max,scope=full + cache-from: type=gha,scope=full-cache + cache-to: type=gha,mode=max,scope=full-cache platforms: linux/amd64,linux/arm64 build-args: | - INSTALL_EXT=true \ No newline at end of file + INSTALL_EXT=true + # 确保构建完全独立,不共享缓存或中间层 + provenance: false + no-cache: true \ No newline at end of file