Skip to content

Commit

Permalink
Log in to GHCR to enable cache (#1251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard87 authored Dec 12, 2024
1 parent dedbca8 commit 4fa2b81
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions .github/workflows/build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
name: Build Operator
outputs:
tag: ${{ steps.metadata.outputs.tag }}
fullname: ${{ steps.metadata.outputs.fullname }}
fullname_latest: ${{ steps.metadata.outputs.fullname_latest }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -62,8 +62,7 @@ jobs:
name: Build Pipeline runner
outputs:
tag_latest: ${{ steps.metadata.outputs.tag_latest }}
tag: ${{ steps.metadata.outputs.tag }}
fullname: ${{ steps.metadata.outputs.fullname }}
fullname_latest: ${{ steps.metadata.outputs.fullname_latest }}
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -166,6 +165,13 @@ jobs:
- name: ACR Login
run: az acr login --name ${{ matrix.target.acr-name }}

- name: GHCR Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

Expand All @@ -180,8 +186,8 @@ jobs:
linux/arm64
tags: |
${{ steps.metadata.outputs.operator }}
cache-from: "type=registry,ref=${{ needs.build-operator.outputs.fullname }}-buildcache"
cache-to: "type=registry,ref=${{ needs.build-operator.outputs.fullname }}-buildcache,mode=max"
cache-from: "type=registry,ref=${{ needs.build-operator.outputs.fullname_latest }}-buildcache"
cache-to: "type=registry,ref=${{ needs.build-operator.outputs.fullname_latest }}-buildcache,mode=max"

- name: Build and push pipeline-runner docker image
uses: docker/build-push-action@v5
Expand All @@ -194,8 +200,8 @@ jobs:
linux/arm64
tags: |
${{ steps.metadata.outputs.pipeline_latest }}
cache-from: "type=registry,ref=${{ needs.build-pipelinerunner.outputs.fullname }}-buildcache"
cache-to: "type=registry,ref=${{ needs.build-pipelinerunner.outputs.fullname }}-buildcache,mode=max"
cache-from: "type=registry,ref=${{ needs.build-pipelinerunner.outputs.fullname_latest }}-buildcache"
cache-to: "type=registry,ref=${{ needs.build-pipelinerunner.outputs.fullname_latest }}-buildcache,mode=max"

- name: Revoke GitHub IP on ACR
if: ${{ steps.update_firewall.outcome == 'success' && !cancelled()}} # Always run this step even if previous step failed
Expand Down

0 comments on commit 4fa2b81

Please sign in to comment.