Enable new DL-Cache in Workflow

This commit is contained in:
BtbN 2023-06-18 21:26:29 +02:00
parent 61debb00e5
commit 3e75fcc0e4

View file

@ -61,8 +61,11 @@ jobs:
id: imagename
run: |
IMG="${GITHUB_REPOSITORY,,}/base"
DLIMG="${GITHUB_REPOSITORY,,}/dl_cache"
echo "name=ghcr.io/${IMG/ /-}" >> $GITHUB_OUTPUT
echo "rawname=${IMG/ /-}" >> $GITHUB_OUTPUT
echo "dlname=ghcr.io/${DLIMG/ /-}" >> $GITHUB_OUTPUT
echo "dlrawname=${DLIMG/ /-}" >> $GITHUB_OUTPUT
- name: Stop Commands
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
- name: Build target base image
@ -74,6 +77,18 @@ jobs:
tags: ${{ steps.imagename.outputs.name }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.name }}:cache
- name: Generate download cache Dockerfile
run: ./generate.sh dl only
- name: Build download cache image
uses: docker/build-push-action@v3
with:
context: .
file: Dockerfile.dl
pull: true
push: true
tags: ${{ steps.imagename.outputs.dlname }}:latest
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.dlname }}:cache
cache-from: type=registry,ref=${{ steps.imagename.outputs.dlname }}:cache
- name: Cleanup
if: ${{ env.HAVE_CLEANUP_PAT == 'true' }}
continue-on-error: true
@ -85,6 +100,17 @@ jobs:
repository: ${{ github.repository }}
owner_type: user
untagged_only: true
- name: Cleanup Download Cache
if: ${{ env.HAVE_CLEANUP_PAT == 'true' }}
continue-on-error: true
uses: BtbN/delete-untagged-ghcr-action@main
with:
token: ${{ secrets.CLEANUP_PAT }}
package_name: ${{ steps.imagename.outputs.dlrawname }}
repository_owner: ${{ github.repository_owner }}
repository: ${{ github.repository }}
owner_type: user
untagged_only: true
build_target_bases:
name: Build target base image
if: ${{ github.event.inputs.buildOnly != 'true' }}