Skip to content

Commit 0310dfd

Browse files
Merge pull request #6742 from onflow/jp/support-private-registry
Add support for private registry builds
2 parents 74f1f9f + f1572fe commit 0310dfd

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

.github/workflows/builds.yml

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ on:
4343
type: boolean
4444
description: 'Build amd64 `without_adx` and `without_netgo_without_adx` images, and arm64 images'
4545
required: false
46+
private_build:
47+
type: boolean
48+
description: 'Build private images'
49+
required: false
4650

4751
jobs:
4852
# matrix_builder generates a matrix that includes the roles selected in the input
@@ -109,16 +113,30 @@ jobs:
109113
credentials_json: ${{ secrets.GCR_SERVICE_KEY_SECRET }}
110114
- name: Set up Google Cloud SDK
111115
uses: google-github-actions/setup-gcloud@v1
112-
- name: Authenticate docker with gcloud
116+
117+
- name: Authenticate Docker with gcloud
113118
run: |
114-
gcloud auth configure-docker
119+
if [[ "${{ github.event.inputs.private_build }}" == "true" ]]; then
120+
gcloud auth configure-docker us-central1-docker.pkg.dev
121+
else
122+
gcloud auth configure-docker
123+
fi
124+
125+
- name: Set CONTAINER_REGISTRY
126+
id: set-registry
127+
run: |
128+
if [[ "${{ github.event.inputs.private_build }}" == "true" ]]; then
129+
echo "CONTAINER_REGISTRY=${{ vars.PRIVATE_REGISTRY }}" >> $GITHUB_ENV
130+
else
131+
echo "CONTAINER_REGISTRY=${{ vars.PUBLIC_REGISTRY }}" >> $GITHUB_ENV
132+
fi
115133
116134
- name: Build/Push ${{ matrix.role }} amd64 images with adx (default)
117135
env:
118136
IMAGE_TAG: ${{ inputs.docker_tag }}
119137
CADENCE_DEPLOY_KEY: ${{ secrets.CADENCE_DEPLOY_KEY }}
120138
run: |
121-
make docker-build-${{ matrix.role }}-with-adx docker-push-${{ matrix.role }}-with-adx
139+
make docker-build-${{ matrix.role }}-with-adx docker-push-${{ matrix.role }}-with-adx CONTAINER_REGISTRY=$CONTAINER_REGISTRY
122140
123141
- name: Build/Push ${{ matrix.role }} amd64 images without netgo and without adx, arm64 images
124142
if: ${{ inputs.include_alternative_builds }}
@@ -128,7 +146,7 @@ jobs:
128146
run: |
129147
make docker-build-${{ matrix.role }}-without-adx docker-push-${{ matrix.role }}-without-adx \
130148
docker-build-${{ matrix.role }}-without-netgo-without-adx docker-push-${{ matrix.role }}-without-netgo-without-adx \
131-
docker-cross-build-${{ matrix.role }}-arm docker-push-${{ matrix.role }}-arm
149+
docker-cross-build-${{ matrix.role }}-arm docker-push-${{ matrix.role }}-arm CONTAINER_REGISTRY=$CONTAINER_REGISTRY
132150
133151
134152

0 commit comments

Comments
 (0)