mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 07:14:47 -05:00
ci: create cache always in main, skip saving cache in PRs (#10560)
This commit is contained in:
parent
640d431b35
commit
4f93cf9d75
1 changed files with 27 additions and 4 deletions
31
.github/workflows/ci.yml
vendored
31
.github/workflows/ci.yml
vendored
|
@ -190,13 +190,36 @@ jobs:
|
|||
key:
|
||||
a-cargo-home-${{ matrix.os }}-${{ hashFiles('Cargo.lock') }}
|
||||
|
||||
- name: Cache build output
|
||||
uses: actions/cache@v2
|
||||
# In main branch, always creates fresh cache
|
||||
- name: Cache build output (main)
|
||||
# TODO(kt3k): Change the version to the released version
|
||||
# when https://github.com/actions/cache/pull/489 (or 571) is merged.
|
||||
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
|
||||
if: github.ref == 'refs/heads/main'
|
||||
with:
|
||||
path: |
|
||||
./target
|
||||
key:
|
||||
a-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ hashFiles('Cargo.lock') }}
|
||||
key: |
|
||||
a-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ hashFiles('Cargo.lock') }}-${{ github.sha }}
|
||||
|
||||
# Restores cache from the latest main branch's Cache
|
||||
- name: Cache build output (PR)
|
||||
# TODO(kt3k): Change the version to the released version
|
||||
# when https://github.com/actions/cache/pull/489 (or 571) is merged.
|
||||
uses: actions/cache@03e00da99d75a2204924908e1cca7902cafce66b
|
||||
if: github.ref != 'refs/heads/main'
|
||||
with:
|
||||
path: |
|
||||
./target
|
||||
key: |
|
||||
dummy # Cache never be created for this key.
|
||||
restore-keys: |
|
||||
a-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ hashFiles('Cargo.lock') }}-
|
||||
|
||||
# Skips saving cache in PR branches
|
||||
- name: Skip save cache (PR)
|
||||
run: echo "CACHE_SKIP_SAVE=true" >> $GITHUB_ENV
|
||||
if: github.ref != 'refs/heads/main'
|
||||
|
||||
- name: Apply and update mtime cache
|
||||
uses: ./.github/mtime_cache
|
||||
|
|
Loading…
Reference in a new issue