Enable new DL-Cache in Workflow
This commit is contained in:
parent
61debb00e5
commit
3e75fcc0e4
1 changed files with 26 additions and 0 deletions
26
.github/workflows/build.yml
vendored
26
.github/workflows/build.yml
vendored
|
@ -61,8 +61,11 @@ jobs:
|
||||||
id: imagename
|
id: imagename
|
||||||
run: |
|
run: |
|
||||||
IMG="${GITHUB_REPOSITORY,,}/base"
|
IMG="${GITHUB_REPOSITORY,,}/base"
|
||||||
|
DLIMG="${GITHUB_REPOSITORY,,}/dl_cache"
|
||||||
echo "name=ghcr.io/${IMG/ /-}" >> $GITHUB_OUTPUT
|
echo "name=ghcr.io/${IMG/ /-}" >> $GITHUB_OUTPUT
|
||||||
echo "rawname=${IMG/ /-}" >> $GITHUB_OUTPUT
|
echo "rawname=${IMG/ /-}" >> $GITHUB_OUTPUT
|
||||||
|
echo "dlname=ghcr.io/${DLIMG/ /-}" >> $GITHUB_OUTPUT
|
||||||
|
echo "dlrawname=${DLIMG/ /-}" >> $GITHUB_OUTPUT
|
||||||
- name: Stop Commands
|
- name: Stop Commands
|
||||||
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
|
run: T="$(echo -n ${{ github.token }} | sha256sum | head -c 64)" && echo -e "::add-mask::${T}\n::stop-commands::${T}"
|
||||||
- name: Build target base image
|
- name: Build target base image
|
||||||
|
@ -74,6 +77,18 @@ jobs:
|
||||||
tags: ${{ steps.imagename.outputs.name }}:latest
|
tags: ${{ steps.imagename.outputs.name }}:latest
|
||||||
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
|
cache-to: type=registry,mode=max,ref=${{ steps.imagename.outputs.name }}:cache
|
||||||
cache-from: type=registry,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
|
- name: Cleanup
|
||||||
if: ${{ env.HAVE_CLEANUP_PAT == 'true' }}
|
if: ${{ env.HAVE_CLEANUP_PAT == 'true' }}
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
|
@ -85,6 +100,17 @@ jobs:
|
||||||
repository: ${{ github.repository }}
|
repository: ${{ github.repository }}
|
||||||
owner_type: user
|
owner_type: user
|
||||||
untagged_only: true
|
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:
|
build_target_bases:
|
||||||
name: Build target base image
|
name: Build target base image
|
||||||
if: ${{ github.event.inputs.buildOnly != 'true' }}
|
if: ${{ github.event.inputs.buildOnly != 'true' }}
|
||||||
|
|
Loading…
Reference in a new issue