From 2bbdfbecabba69a2c6f11193d05405b6a77b0576 Mon Sep 17 00:00:00 2001 From: penguin Date: Fri, 12 Dec 2025 19:56:04 -0600 Subject: [PATCH] infra: actions: cache the docker build --- .gitea/workflows/gentoo-utils.yml | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/.gitea/workflows/gentoo-utils.yml b/.gitea/workflows/gentoo-utils.yml index 936fe39..3baa2f0 100644 --- a/.gitea/workflows/gentoo-utils.yml +++ b/.gitea/workflows/gentoo-utils.yml @@ -3,21 +3,6 @@ name: Gentoo Utils on: [push] jobs: - cache: - runs-on: ubuntu-latest - continue-on-error: true - steps: - - name: Restore git cache - uses: actions/cache@v4 - with: - path: .git - key: gitea-repo-${{ gitea.repository }}-${{ gitea.ref }} - - - name: Checkout repo - uses: actions/checkout@v5 - with: - fetch-depth: 0 - build-oci-image: runs-on: ubuntu-latest continue-on-error: true @@ -39,22 +24,17 @@ jobs: id: image-changes # build image only if 1. changes are detected or 2. an image for the working branch doesnt exist run: | - git --no-pager log --oneline -n 10 - echo "BEFORE = ${{ gitea.event.before }}" branch_name="${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" default_branch_name="${{ gitea.event.repository.default_branch }}" image_tag=latest comparison_hash="${{ gitea.event.before }}" - git --no-pager reflog if [[ "$branch_name" != "${{ gitea.event.repository.default_branch }}" ]]; then image_tag=$branch_name fi # slugify image_tag="$(echo "$image_tag" | sed -E 's/[^a-zA-Z0-9]/-/g')" - - # rebase breaks gitea.event.before, so check to make sure the hash provided exists if ! git merge-base --is-ancestor $comparison_hash $branch_name >/dev/null 2>&1; then comparison_hash=$(git merge-base origin/$default_branch_name $branch_name) @@ -95,6 +75,8 @@ jobs: push: true tags: ${{ vars.REGISTRY_URL }}/${{ gitea.repository }}:${{ steps.image-changes.outputs.image_tag }} context: "{{defaultContext}}:.docker" + cache-from: type=gha + cache-to: type=gha,mode=max outputs: image_tag: ${{ steps.image-changes.outputs.image_tag }}