Skip to content

Commit

Permalink
Move conditionals into determine DockerHub tags step
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcolvar authored Aug 14, 2023
1 parent 516b394 commit 78c8ddd
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions .github/workflows/podman-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,37 +23,40 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Determine DockerHub image tags
id: determine_dockerhub_tags
run: |
AVALON_VERSION=`script/avalon_image_tags.rb -t`
echo "AVALON_VERSION=${AVALON_VERSION}" >> "$GITHUB_OUTPUT"
if [ $IMAGE_TAG = 'develop' ]; then
AVALON_TAGS=`script/avalon_image_tags.rb --branch ${BRANCH} -a ${AVALON_VERSION}-dev | awk 'gsub(","," ")'`
elif [ $IMAGE_TAG = 'production' ]; then
AVALON_TAGS=`script/avalon_image_tags.rb -s -t -a latest | awk 'gsub(","," ")'`
else
AVALON_TAGS=""
fi
echo "tags=${AVALON_TAGS}" >> "$GITHUB_OUTPUT"
echo "Will pushing to DockerHub with tags: ${AVALON_TAGS}"
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@v2
with:
image: avalon
tags: ${{ env.IMAGE_TAG }} ${{ github.sha }}
tags: ${{ env.IMAGE_TAG }} ${{ github.sha }} ${{ steps.determine_dockerhub_tags.outputs.tags }}
containerfiles: ./Dockerfile
oci: true
extra-args: --target ${{ env.BUILD_TARGET }}
- name: Push To GHCR
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
tags: ${{ env.IMAGE_TAG }} ${{ github.sha }}
registry: ${{ env.GHCR_IMAGE_REGISTRY }}
username: ${{ env.GHCR_USER }}
password: ${{ env.GHCR_PASSWORD }}
extra-args: |
--disable-content-trust
- name: Determine develop image tags
if: ${{ env.IMAGE_TAG == 'develop' }}
id: determine_dockerhub_tags
run: |
AVALON_VERSION=`script/avalon_image_tags.rb -t`
echo "AVALON_VERSION=${AVALON_VERSION}" >> "$GITHUB_OUTPUT"
AVALON_TAGS=`script/avalon_image_tags.rb --branch ${BRANCH} -a ${AVALON_VERSION}-dev | awk 'gsub(","," ")'`
echo "tags=${AVALON_TAGS}" >> "$GITHUB_OUTPUT"
echo "Pushing with tags: ${AVALON_TAGS}"
- name: Develop Push To Dockerhub
if: ${{ env.IMAGE_TAG == 'develop' }}
- name: Push To Dockerhub
uses: redhat-actions/push-to-registry@v2
with:
image: ${{ steps.build_image.outputs.image }}
Expand Down

0 comments on commit 78c8ddd

Please sign in to comment.