diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5e955aa..773e2ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,6 +14,7 @@ jobs: runs-on: ubuntu-latest env: PYTHONUTF8: 1 + CACHEKEY: dist steps: - name: Checkout uses: actions/checkout@v4 @@ -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: | @@ -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 }}