From a27a86541628401588b71447905a77acd1aa69b4 Mon Sep 17 00:00:00 2001 From: deathaxe Date: Fri, 24 Nov 2023 20:14:50 +0100 Subject: [PATCH] Cache Handling --- .github/workflows/deploy.yml | 20 +++----------------- tasks/crawl.py | 2 +- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c870582..18d9472 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -30,15 +30,12 @@ jobs: id: checkout-repository uses: actions/checkout@v4 - - name: Restore cache + - name: Cache state id: restore-cache uses: actions/cache/restore@v3 with: - path: |- - cache/ - _site/libraries.json.sha512 - blacklist.json - key: ${{ runner.os }}-state + path: cache + key: ${{ runner.os }}-state-${{ hashFiles('cache/*') }} restore-keys: | ${{ runner.os }}-state @@ -49,17 +46,6 @@ jobs: GH_PASS: ${{secrets.GH_APP_TOKEN}} run: python3 tasks crawl - - name: Save cache - id: save-cache - uses: actions/cache/save@v3 - if: always() - with: - path: |- - cache/ - _site/libraries.json.sha512 - blacklist.json - key: ${{ runner.os }}-state-${{ hashFiles('cache/*') }} - - name: Setup pages id: setup-pages if: steps.resolve-repository.outputs.updated == 'true' diff --git a/tasks/crawl.py b/tasks/crawl.py index 68c1f72..de4e6eb 100644 --- a/tasks/crawl.py +++ b/tasks/crawl.py @@ -57,7 +57,7 @@ def store_asset(filename, content): new_filename_bz2 = filename + '.bz2-new' filename_gz = filename + '.gz' filename_bz2 = filename + '.bz2' - filename_sha512 = filename + '.sha512' + filename_sha512 = Path(sys_path.pc_cache_dir()) / (Path(filename).name + '.sha512') encoded_content = content.encode('utf-8') content_hash = hashlib.sha512(encoded_content).hexdigest().encode('utf-8')