Skip to content

Commit 43435aa

Browse files
committed
ci: use registry cache on ghcr.io
1 parent 5d9127d commit 43435aa

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

.github/workflows/build.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
push:
1212
branches:
1313
- main
14+
- "ghcr-cache"
1415
paths:
1516
- ".github/workflows/build.yml"
1617
- "docker/**"
@@ -67,7 +68,8 @@ jobs:
6768
needs: build_matrix
6869
runs-on: ${{ matrix.runner }}
6970
permissions:
70-
actions: write # this permission is needed to delete cache
71+
packages: write
72+
contents: read
7173
strategy:
7274
fail-fast: false
7375
matrix:
@@ -94,9 +96,9 @@ jobs:
9496
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && github.repository == 'pypa/manylinux'
9597
uses: docker/login-action@v3
9698
with:
97-
registry: quay.io
98-
username: ${{ secrets.QUAY_USERNAME }}
99-
password: ${{ secrets.QUAY_PASSWORD }}
99+
registry: ghcr.io
100+
username: ${{ github.actor }}
101+
password: ${{ secrets.GITHUB_TOKEN }}
100102

101103
- name: Restore cache
102104
if: github.event_name != 'workflow_dispatch' || fromJSON(github.event.inputs.useCache)

build.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ elif [ "${MANYLINUX_BUILD_FRONTEND}" == "podman" ]; then
9797
elif [ "${MANYLINUX_BUILD_FRONTEND}" == "docker-buildx" ]; then
9898
USE_LOCAL_CACHE=1
9999
CACHE_STORE=("--cache-to=type=local,dest=$(pwd)/.buildx-cache-staging-${POLICY}_${PLATFORM},mode=max,compression=zstd,compression-level=22,force-compression=true")
100-
if [ "${GITHUB_REPOSITORY:-}_${GITHUB_EVENT_NAME:-}_${GITHUB_REF:-}" == "pypa/manylinux_push_refs/heads/main" ]; then
101-
CACHE_STORE+=("--cache-to=type=registry,ref=quay.io/pypa/manylinux_cache:${POLICY}_${PLATFORM}_main,mode=max,compression=zstd,compression-level=22,force-compression=true")
100+
if [ "${GITHUB_REPOSITORY:-}_${GITHUB_EVENT_NAME:-}_${GITHUB_REF:-}" == "pypa/manylinux_push_refs/heads/ghcr-cache" ]; then
101+
CACHE_STORE+=("--cache-to=type=registry,ref=ghcr.io/pypa/manylinux-cache:${POLICY}_${PLATFORM}_main,mode=max,compression=zstd,compression-level=22,force-compression=true")
102102
fi
103103
docker buildx build \
104104
--load \
105-
"--cache-from=type=registry,ref=quay.io/pypa/manylinux_cache:${POLICY}_${PLATFORM}_main" \
105+
"--cache-from=type=registry,ref=ghcr.io/pypa/manylinux-cache:${POLICY}_${PLATFORM}_main" \
106106
"--cache-from=type=local,src=$(pwd)/.buildx-cache-${POLICY}_${PLATFORM}" \
107107
"${CACHE_STORE[@]}" \
108108
"${BUILD_ARGS_COMMON[@]}"

0 commit comments

Comments
 (0)