From afba5ffe0a5d820ddb308fb774d03a0a3ed14797 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Mon, 30 Jun 2025 16:41:45 -0700 Subject: [PATCH] update all cache --- .github/workflows/pull-docker-dryrun.yml | 27 +++++++++++++++++++---- .github/workflows/release-nightly.yml | 4 ++++ .github/workflows/release-tag-rc.yml | 2 ++ .github/workflows/release-tag-version.yml | 2 ++ 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/.github/workflows/pull-docker-dryrun.yml b/.github/workflows/pull-docker-dryrun.yml index abbf3fa33f..205fa4e87d 100644 --- a/.github/workflows/pull-docker-dryrun.yml +++ b/.github/workflows/pull-docker-dryrun.yml @@ -16,24 +16,43 @@ jobs: needs: files-changed runs-on: ubuntu-latest steps: + - name: Get cleaned branch name + id: clean_name + run: | + # if main then say nightly otherwise cleanup name + if [ "${{ github.base_ref }}" = "refs/heads/main" ]; then + echo "branch=nightly" >> "$GITHUB_OUTPUT" + exit 0 + fi + REF_NAME=$(echo "${{ github.base_ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') + echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT" - uses: docker/setup-buildx-action@v3 - uses: docker/build-push-action@v5 with: push: false tags: gitea/gitea:linux-amd64 - cache-from: type=registry,ref=gitea/gitea:buildcache-pr-amd64 - cache-to: type=registry,ref=gitea/gitea:buildcache-pr-amd64,mode=max + platforms: linux/amd64,linux/arm64,linux/riscv64 + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }} rootless: if: needs.files-changed.outputs.docker == 'true' || needs.files-changed.outputs.actions == 'true' needs: files-changed runs-on: ubuntu-latest steps: + - name: Get cleaned branch name + id: clean_name + run: | + # if main then say nightly otherwise cleanup name + if [ "${{ github.base_ref }}" = "refs/heads/main" ]; then + echo "branch=nightly" >> "$GITHUB_OUTPUT" + exit 0 + fi + REF_NAME=$(echo "${{ github.base_ref }}" | sed -e 's/refs\/heads\///' -e 's/refs\/tags\///' -e 's/release\/v//') + echo "branch=${REF_NAME}-nightly" >> "$GITHUB_OUTPUT" - uses: docker/setup-buildx-action@v3 - uses: docker/build-push-action@v5 with: push: false file: Dockerfile.rootless tags: gitea/gitea:linux-amd64 - cache-from: type=registry,ref=gitea/gitea:buildcache-pr-amd64-rootless - cache-to: type=registry,ref=gitea/gitea:buildcache-pr-amd64-rootless,mode=max + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }}-rootless diff --git a/.github/workflows/release-nightly.yml b/.github/workflows/release-nightly.yml index 3d652e4ad8..f3dcb5c673 100644 --- a/.github/workflows/release-nightly.yml +++ b/.github/workflows/release-nightly.yml @@ -98,6 +98,8 @@ jobs: tags: |- gitea/gitea:${{ steps.clean_name.outputs.branch }} ghcr.io/go-gitea/gitea:${{ steps.clean_name.outputs.branch }} + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }} + cache-to: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }},mode=max nightly-docker-rootless: runs-on: namespace-profile-gitea-release-docker permissions: @@ -141,3 +143,5 @@ jobs: tags: |- gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless ghcr.io/go-gitea/gitea:${{ steps.clean_name.outputs.branch }}-rootless + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }}-rootless + cache-to: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }}-rootless,mode=max diff --git a/.github/workflows/release-tag-rc.yml b/.github/workflows/release-tag-rc.yml index f4776a9ed8..a5228335d6 100644 --- a/.github/workflows/release-tag-rc.yml +++ b/.github/workflows/release-tag-rc.yml @@ -107,6 +107,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }} docker-rootless: runs-on: namespace-profile-gitea-release-docker permissions: @@ -151,3 +152,4 @@ jobs: file: Dockerfile.rootless tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }}-rootless diff --git a/.github/workflows/release-tag-version.yml b/.github/workflows/release-tag-version.yml index ad0820f31f..0a30ba40ea 100644 --- a/.github/workflows/release-tag-version.yml +++ b/.github/workflows/release-tag-version.yml @@ -115,6 +115,7 @@ jobs: push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }} docker-rootless: runs-on: namespace-profile-gitea-release-docker steps: @@ -162,3 +163,4 @@ jobs: file: Dockerfile.rootless tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} + cache-from: type=registry,ref=gitea/gitea:buildcache-${{ steps.clean_name.outputs.branch }}-rootless