Browse Source

Switch to Github Actions cache

- remove releasecache-cleanup.yml, GHA cache auto removes oldest cache files after 10GB usage or files not being accessed for more than 7 days
- remove unnecessary step in release.yml, GHA cache doesn't require GHCR login
pull/4585/head
dfunkt 11 months ago
parent
commit
6882284edd
  1. 18
      .github/workflows/release.yml
  2. 26
      .github/workflows/releasecache-cleanup.yml

18
.github/workflows/release.yml

@ -150,20 +150,6 @@ jobs:
run: |
echo "CONTAINER_REGISTRIES=${CONTAINER_REGISTRIES:+${CONTAINER_REGISTRIES},}${{ vars.QUAY_REPO }}" | tee -a "${GITHUB_ENV}"
- name: Configure build cache from/to
shell: bash
run: |
#
# Check if there is a GitHub Container Registry Login and use it for caching
if [[ -n "${HAVE_GHCR_LOGIN}" ]]; then
echo "BAKE_CACHE_FROM=type=registry,ref=${{ vars.GHCR_REPO }}-buildcache:${{ matrix.base_image }}" | tee -a "${GITHUB_ENV}"
echo "BAKE_CACHE_TO=type=registry,ref=${{ vars.GHCR_REPO }}-buildcache:${{ matrix.base_image }},mode=max" | tee -a "${GITHUB_ENV}"
else
echo "BAKE_CACHE_FROM="
echo "BAKE_CACHE_TO="
fi
#
- name: Add localhost registry
if: ${{ matrix.base_image == 'alpine' }}
shell: bash
@ -184,8 +170,8 @@ jobs:
files: docker/docker-bake.hcl
targets: "${{ matrix.base_image }}-multi"
set: |
*.cache-from=${{ env.BAKE_CACHE_FROM }}
*.cache-to=${{ env.BAKE_CACHE_TO }}
*.cache-from=type=gha,scope=${{ matrix.base_image }}
*.cache-to=type=gha,scope=${{ matrix.base_image }},mode=max
# Extract the Alpine binaries from the containers

26
.github/workflows/releasecache-cleanup.yml

@ -1,26 +0,0 @@
on:
workflow_dispatch:
inputs:
manual_trigger:
description: "Manual trigger buildcache cleanup"
required: false
default: ""
schedule:
- cron: '0 1 * * FRI'
name: Cleanup
jobs:
releasecache-cleanup:
name: Releasecache Cleanup
runs-on: ubuntu-22.04
continue-on-error: true
timeout-minutes: 30
steps:
- name: Delete vaultwarden-buildcache containers
uses: actions/delete-package-versions@e5bc658cc4c965c472efe991f8beea3981499c55 # v5.0.0
with:
package-name: 'vaultwarden-buildcache'
package-type: 'container'
min-versions-to-keep: 0
delete-only-untagged-versions: 'false'
Loading…
Cancel
Save