Skip to content

Commit

Permalink
attempt to use gha caching
Browse files Browse the repository at this point in the history
  • Loading branch information
probablyjassin committed Nov 24, 2024
1 parent 8a644b9 commit 0b45743
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions .github/workflows/nuxt-to-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,6 @@ jobs:
type=raw,value=latest
type=sha,prefix=
- name: Check for existing cache
id: cache-check
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile', '**/package*.json') }}

- name: Delete old caches if no cache found
if: steps.cache-check.outputs.cache-hit != 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if gh cache list --repo ${{ github.repository }} | grep -q 'buildx'; then
gh cache delete --all --repo ${{ github.repository }}
else
echo "No caches to delete."
fi
- name: Delete old package versions
uses: actions/delete-package-versions@v5
with:
Expand All @@ -73,14 +55,6 @@ jobs:
# When set greater than 0, all deletable package versions except the specified number will be deleted.
min-versions-to-keep: 3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ hashFiles('**/Dockerfile', '**/package*.json') }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
Expand All @@ -89,11 +63,5 @@ jobs:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max

# Temp fix for growing cache size
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
cache-from: type=gha
cache-to: type=gha,mode=max

0 comments on commit 0b45743

Please sign in to comment.