diff --git a/.gitea/workflows/deploy-music.yml b/.gitea/workflows/deploy-music.yml index e55e61e..4c7d47a 100644 --- a/.gitea/workflows/deploy-music.yml +++ b/.gitea/workflows/deploy-music.yml @@ -31,15 +31,7 @@ jobs: - name: Build rust (musl static) run: | export PATH="$HOME/.cargo/bin:$PATH" - # 强制 invalidate music crate 的 fingerprint —— act_runner workdir - # 复用导致 cargo 偶尔会"看不见"main.rs 修改,链不出新 binary。 - # `cargo clean -p` 只清这一 crate,依赖 deps 的编译结果保留,重 link 大约 30-60s。 - cargo clean -p "$APP" --release --target x86_64-unknown-linux-musl - rm -f "target/x86_64-unknown-linux-musl/release/$APP" cargo build --release --target x86_64-unknown-linux-musl -p "$APP" - # 防御性检查:commit 字符串必须出现在 binary 里 - SHA="${{ steps.tag.outputs.sha }}" - test -f "target/x86_64-unknown-linux-musl/release/$APP" - name: Build frontend run: | @@ -52,10 +44,13 @@ jobs: REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }} run: | echo "$REGISTRY_TOKEN" | docker login registry.famzheng.me -u mochi --password-stdin - # main app - docker build -f "apps/$APP/Dockerfile" -t "$IMAGE:${{ steps.tag.outputs.sha }}" . + # main app —— 必须 --no-cache,否则 docker layer cache 会把"COPY target/.../music" + # 这一层套用历史 binary(之前几次 deploy 实测过:cargo 生成了新 binary 但 + # docker 看缓存 layer 命中直接复用旧 binary,新代码完全没进 image) + docker build --no-cache -f "apps/$APP/Dockerfile" \ + -t "$IMAGE:${{ steps.tag.outputs.sha }}" . docker push "$IMAGE:${{ steps.tag.outputs.sha }}" - # chord-fetcher sidecar (python + chromium) + # chord-fetcher sidecar:layer cache 这里有用(chromium apt 不变),保留 docker build -f "apps/$APP/chord/Dockerfile" \ -t "$CHORD_IMAGE:${{ steps.tag.outputs.sha }}" \ "apps/$APP/chord"