Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update container build to only push on merges #717

Merged
merged 10 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@ env:
VERSION: ${{ github.event.pull_request.number || 'latest' }}
# Use ghcr.io/radius-project/dev for PR build. Otherwise, use ghcr.io/radius-project.
CONTAINER_REGISTRY: ${{ github.event.pull_request.number && 'ghcr.io/radius-project/dev' || 'ghcr.io/radius-project' }}
# Set to true to push images to registry.
PUSH_IMAGE: true


jobs:
build-ghcr:
name: Build and push sample images to GHCR
Expand All @@ -48,8 +46,18 @@ jobs:
- directory: samples/volumes/
image: samples/volumes
steps:
- name: Evaluate push
id: eval_push
run: |
if [[ "${{ github.event_name }}" == "push" ]]; then
PUSH_IMAGE='true'
else
PUSH_IMAGE='false'
fi
echo "PUSH_IMAGE=${PUSH_IMAGE}" >> $GITHUB_OUTPUT
- name: Checkout code
uses: actions/checkout@v4
# Using fromJSON to convert string to boolean. Ref. https://github.com/actions/runner/issues/1483
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
Expand All @@ -60,5 +68,5 @@ jobs:
uses: docker/build-push-action@v4
with:
context: ./${{ matrix.directory }}
push: ${{ env.PUSH_IMAGE }}
push: ${{ fromJSON(steps.eval_push.outputs.PUSH_IMAGE) }}
AaronCrawfis marked this conversation as resolved.
Show resolved Hide resolved
tags: ${{ env.CONTAINER_REGISTRY }}/${{ matrix.image }}:${{ env.VERSION }}
6 changes: 0 additions & 6 deletions .github/workflows/validate-bicep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,6 @@ jobs:
steps:
- name: Check out repo
uses: actions/checkout@v2
- name: az CLI login
run: |
az login --service-principal \
--username ${{ secrets.AZURE_SP_TESTS_APPID }} \
--password ${{ secrets.AZURE_SP_TESTS_PASSWORD }} \
--tenant ${{ secrets.AZURE_SP_TESTS_TENANTID }}
- name: Parse release version and set environment variables
run: python ./.github/scripts/get_docs_version.py
- name: Download rad-bicep
Expand Down
Loading