Only use default tag when in pull request
All checks were successful
Build container image / Build and push image (pull_request) Successful in 19m47s
All checks were successful
Build container image / Build and push image (pull_request) Successful in 19m47s
This commit is contained in:
22
.github/workflows/build.yml
vendored
22
.github/workflows/build.yml
vendored
@@ -52,7 +52,7 @@ jobs:
|
||||
run: |
|
||||
echo "DEFAULT_TAG=pr-${PULL_REQUEST_NUMBER}" >> ${GITHUB_ENV}
|
||||
|
||||
- name: Setup other dependencies
|
||||
- name: Setup Podman and other dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
sudo apt-get update
|
||||
@@ -133,16 +133,14 @@ jobs:
|
||||
|
||||
- name: Build Image
|
||||
id: build_image
|
||||
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2
|
||||
with:
|
||||
containerfiles: |
|
||||
./Containerfile
|
||||
image: ${{ env.IMAGE_NAME }}
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
oci: false
|
||||
build-args: |
|
||||
BASE_IMAGE=${BASE_IMAGE}
|
||||
FEDORA_VERSION=${FEDORA_VERSION}
|
||||
shell: bash
|
||||
run: |
|
||||
buildah bud \
|
||||
--format docker \
|
||||
--tag "localhost/${IMAGE_NAME}:${DEFAULT_TAG}" \
|
||||
--build-arg BASE_IMAGE=${BASE_IMAGE} \
|
||||
--build-arg FEDORA_VERSION=${FEDORA_VERSION} \
|
||||
-f ./Containerfile
|
||||
|
||||
# These `if` statements are so that pull requests for your custom images do not make it publish any packages under your name without you knowing
|
||||
# They also check if the runner is on the default branch so that things like the merge queue (if you enable it), are going to work
|
||||
@@ -184,7 +182,7 @@ jobs:
|
||||
with:
|
||||
registry: ${{ env.IMAGE_REGISTRY }}
|
||||
image: ${{ env.IMAGE_NAME }}
|
||||
tags: ${{ steps.metadata.outputs.tags }}
|
||||
tags: ${{ github.event_name != 'pull_request' && steps.metadata.outputs.tags || env.DEFAULT_TAG }}
|
||||
username: ${{ env.REGISTRY_USER }}
|
||||
password: ${{ env.REGISTRY_PASSWORD }}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user