ci: build published binaries without restoring any cache (#17299)

* ci: build published binaries without restoring any cache

Nightly and tag builds restored rust-cache (which also holds ~/.cargo/bin,
where the bridge's flutter_rust_bridge_codegen lives), the run-vcpkg cache, the
run-on-arch container images pushed to GHCR, and the bridge's Flutter and pub
cache. Other workflow runs can write all of these, so an entry planted by one
of them would end up in a published binary, past the lockfile and hash checks.

With upload-artifact set, those steps are now skipped or told not to cache,
and the cache token is no longer exported to every build step. CI runs without
upload-artifact keep their caches.

The cost is small today: vcpkg's x-gha binary cache backend has been removed
upstream, so every run already builds the vcpkg ports from source, and the
last nightly found no rust-cache entry for any job. What is new is that the
run-on-arch images are rebuilt in every published build.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq

* DO NOT MERGE: run this PR's CI the way a published build runs (no cache)

* Revert the temporary no-cache CI commit

Its CI run (46105502143) built every PR CI job the way a published build now
runs, without any cache, and passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01JAxkkiaGp2k8okvs4MpCUq

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
RustDeskandClaude Opus 5.5 authored and GitHub committed 2026-11-29 21:32:38 +08:00
1 parent ef49275ddb
commit aedb901f10
2 files changed
+36 -10

No files matched your search

+8 -1
View File
@@ -4,6 +4,11 @@ name: Build flutter-rust-bridge
on:
workflow_call:
inputs:
# false for builds that publish: see the note above `jobs:` in flutter-build.yml.
use-cache:
type: boolean
default: true
env:
CARGO_EXPAND_VERSION: "1.0.95"
@@ -70,11 +75,13 @@ jobs:
components: "rustfmt"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: ${{ inputs.use-cache }}
with:
prefix-key: bridge-${{ matrix.job.os }}
- name: Cache Bridge
id: cache-bridge
if: ${{ inputs.use-cache }}
uses: actions/cache@6f8efc29b200d32929f49075959781ed54ec270c # v3
with:
path: /tmp/flutter_rust_bridge
@@ -85,7 +92,7 @@ jobs:
with:
channel: "stable"
flutter-version: ${{ matrix.job.flutter-version }}
cache: true
cache: ${{ inputs.use-cache }}
- name: Install flutter rust bridge deps
shell: bash
+28 -9
View File
@@ -65,6 +65,10 @@ env:
PUBLISH_UPDATE_METADATA: "${{ inputs.publish-update-metadata }}"
SIGN_BASE_URL: "${{ secrets.SIGN_BASE_URL }}-2"
# Builds that publish (upload-artifact: nightly and tags) neither restore nor save a cache: the
# rust-cache, run-vcpkg, run-on-arch image and bridge caches are skipped there, and so is exporting
# the cache token to the build steps. Other workflow runs can write those caches, so a published
# binary must not be built from one. CI runs keep them.
jobs:
validate-update-metadata-keys:
runs-on: ubuntu-22.04
@@ -141,6 +145,8 @@ jobs:
generate-bridge:
needs: [validate-update-metadata-keys]
uses: ./.github/workflows/bridge.yml
with:
use-cache: ${{ !inputs.upload-artifact }}
build-RustDeskTempTopMostWindow:
needs: [validate-update-metadata-keys]
@@ -194,6 +200,7 @@ jobs:
}
steps:
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -311,6 +318,7 @@ jobs:
components: "rustfmt"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: ${{ !inputs.upload-artifact }}
with:
prefix-key: ${{ matrix.job.os }}
@@ -319,7 +327,7 @@ jobs:
with:
vcpkgDirectory: C:\vcpkg
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
doNotCache: false
doNotCache: ${{ inputs.upload-artifact }}
- name: Install vcpkg dependencies
env:
@@ -622,6 +630,7 @@ jobs:
# - { target: aarch64-pc-windows-msvc, os: windows-2022 }
steps:
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -655,6 +664,7 @@ jobs:
rustup default nightly-2023-10-13-${{ matrix.job.target }} --force-non-host
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: ${{ !inputs.upload-artifact }}
with:
prefix-key: ${{ matrix.job.os }}-sciter
@@ -663,7 +673,7 @@ jobs:
with:
vcpkgDirectory: C:\vcpkg
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
doNotCache: false
doNotCache: ${{ inputs.upload-artifact }}
- name: Install vcpkg dependencies
env:
@@ -832,6 +842,7 @@ jobs:
}
steps:
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -863,7 +874,7 @@ jobs:
uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
doNotCache: false
doNotCache: ${{ inputs.upload-artifact }}
- name: Install vcpkg dependencies
run: |
@@ -891,6 +902,7 @@ jobs:
components: "rustfmt"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: ${{ !inputs.upload-artifact }}
with:
prefix-key: rustdesk-lib-cache-ios
key: ${{ matrix.job.target }}
@@ -968,6 +980,7 @@ jobs:
}
steps:
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -1086,6 +1099,7 @@ jobs:
components: "rustfmt"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: ${{ !inputs.upload-artifact }}
with:
prefix-key: ${{ matrix.job.os }}
@@ -1106,7 +1120,7 @@ jobs:
uses: lukka/run-vcpkg@b1a0dd252f06b9e25b3c022a9a03bd7a427fb6a2 # v11
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
doNotCache: false
doNotCache: ${{ inputs.upload-artifact }}
- name: Install vcpkg dependencies
run: |
@@ -1500,6 +1514,7 @@ jobs:
swap-storage: false
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -1587,7 +1602,7 @@ jobs:
with:
vcpkgDirectory: /opt/artifacts/vcpkg
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
doNotCache: false
doNotCache: ${{ inputs.upload-artifact }}
- name: Install vcpkg dependencies
run: |
@@ -1630,6 +1645,7 @@ jobs:
components: "rustfmt"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: ${{ !inputs.upload-artifact }}
with:
prefix-key: rustdesk-lib-cache-android # TODO: drop '-android' part after caches are invalidated
key: ${{ matrix.job.target }}
@@ -1791,6 +1807,7 @@ jobs:
swap-storage: false
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -1985,6 +2002,7 @@ jobs:
}
steps:
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -2057,7 +2075,7 @@ jobs:
with:
vcpkgDirectory: /opt/artifacts/vcpkg
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
doNotCache: false
doNotCache: ${{ inputs.upload-artifact }}
- name: Install vcpkg dependencies
if: matrix.job.arch == 'x86_64' || env.UPLOAD_ARTIFACT == 'true'
@@ -2110,7 +2128,7 @@ jobs:
with:
arch: ${{ matrix.job.arch }}
distro: ${{ matrix.job.distro }}
githubToken: ${{ github.token }}
githubToken: ${{ !inputs.upload-artifact && github.token || '' }}
setup: |
ls -l "${PWD}"
ls -l /opt/artifacts/vcpkg/installed
@@ -2453,6 +2471,7 @@ jobs:
}
steps:
- name: Export GitHub Actions cache environment variables
if: ${{ !inputs.upload-artifact }}
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6
with:
script: |
@@ -2501,7 +2520,7 @@ jobs:
with:
arch: ${{ matrix.job.arch }}
distro: ${{ matrix.job.distro }}
githubToken: ${{ github.token }}
githubToken: ${{ !inputs.upload-artifact && github.token || '' }}
setup: |
ls -l "${PWD}"
dockerRunArgs: |
@@ -2795,7 +2814,7 @@ jobs:
with:
arch: ${{ matrix.job.arch }}
distro: ${{ matrix.job.distro }}
githubToken: ${{ github.token }}
githubToken: ${{ !inputs.upload-artifact && github.token || '' }}
setup: |
ls -l "${PWD}"
dockerRunArgs: |