Skip to content

Commit 586d262

Browse files
committed
ci: add weekly cache rotation for fresh builds
1 parent abe6aa3 commit 586d262

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

.github/workflows/build-and-test.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ jobs:
1818
steps:
1919
- uses: actions/checkout@v6
2020
- uses: dtolnay/rust-toolchain@stable
21+
- name: Get cache week
22+
id: cache-week
23+
run: echo "week=$(date +%Y-%W)" >> $GITHUB_OUTPUT
24+
shell: bash
2125
- uses: Swatinem/rust-cache@v2
2226
with:
23-
prefix-key: "v1-rust"
24-
shared-key: "${{ inputs.os }}"
27+
shared-key: "${{ steps.cache-week.outputs.week }}-${{ inputs.os }}"
2528
cache-on-failure: true
2629
- name: Build workspace
2730
run: cargo build --workspace --all-targets --all-features ${{ inputs.exclude-crates && format('--exclude {0}', inputs.exclude-crates) || '' }}
@@ -37,10 +40,13 @@ jobs:
3740
steps:
3841
- uses: actions/checkout@v6
3942
- uses: dtolnay/rust-toolchain@stable
43+
- name: Get cache week
44+
id: cache-week
45+
run: echo "week=$(date +%Y-%W)" >> $GITHUB_OUTPUT
46+
shell: bash
4047
- uses: Swatinem/rust-cache@v2
4148
with:
42-
prefix-key: "v1-rust"
43-
shared-key: "${{ inputs.os }}"
49+
shared-key: "${{ steps.cache-week.outputs.week }}-${{ inputs.os }}"
4450
save-if: false
4551
- uses: actions/setup-python@v5
4652
with:

0 commit comments

Comments
 (0)