Skip to content

Commit

Permalink
[update] fix cache saving
Browse files Browse the repository at this point in the history
  • Loading branch information
StardustDL committed Feb 6, 2024
1 parent 85afe5d commit 513124e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ jobs:
runs-on: ubuntu-latest
env:
PYTHONUTF8: 1
CACHEKEY: dist
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -33,11 +34,12 @@ jobs:
run: |
python -m pip install -r ./requirements.txt
sed -i 's/\"package\"/\"image\"/' ./config.json
- uses: actions/cache/restore@v3
- name: Restore cache
uses: actions/cache/restore@v3
id: cache-restore
with:
path: ./dist
key: dist
key: ${{ env.CACHEKEY }}
- name: Force update
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && startsWith(github.event.head_commit.message, '[update]') }}
run: |
Expand All @@ -61,11 +63,20 @@ jobs:
path: |
./cache
!./cache/*/wheels
- uses: actions/cache/save@v3
- name: Delete previous cache
if: ${{ steps.cache-restore.outputs.cache-hit }}
continue-on-error: true
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "${{ env.CACHEKEY }}" --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Save cache
uses: actions/cache/save@v3
id: cache-save
with:
path: ./dist
key: dist
key: ${{ env.CACHEKEY }}
# uses: JamesIves/github-pages-deploy-action@v4
# with:
# token: ${{ secrets.PA_TOKEN }}
Expand Down

0 comments on commit 513124e

Please sign in to comment.