Skip to content

Commit

Permalink
Fix Tag scenarios (#74)
Browse files Browse the repository at this point in the history
* Initial commit

* Remove env

* Try env instead of input

* Add labels to docker buildx

* Add quay.expires-after

* Add metadata action

* Attempt to format to list for labels

* Add metadata with image

* Single label test

* Format for list

* Revert back and test

* Image tag for main

* Remove hash from main

* Make latest tag for release as well

* Fix syntax error

* Attempt to fix if cond

* Switch release build order, format

* Test operators

* Test each expression

* Boolean returns 1 or 0 for diff types test

* Seperate if conditions

* Explicity bool

* Try to make expression a bool

* Remove $
  • Loading branch information
jdowni000 authored Sep 12, 2023
1 parent 2558357 commit d540f44
Showing 1 changed file with 21 additions and 5 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/reusable_workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ jobs:
run: |
echo "IMAGE_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Set image tag for main
if: github.ref == 'refs/heads/main' && github.event_name != 'release'
run: |
echo "IMAGE_TAG=main_latest" >> $GITHUB_ENV
- name: Set image tag and expiration for dev
if: github.ref != 'refs/heads/main' && github.event_name != 'release'
run: |
Expand Down Expand Up @@ -74,23 +79,34 @@ jobs:
archetype: ${{ inputs.archetype }}
req_check_only: ${{ inputs.multi_arch }}

- name: Set up Docker Buildx for Multi-Arch
- name: Set up Docker Buildx for multi-arch
if: ${{ inputs.multi_arch }}
uses: docker/setup-buildx-action@v2

- name: Login to Quay for Multi-Arch
- name: Login to Quay for multi-arch
if: ${{ inputs.multi_arch }}
uses: docker/login-action@v2
with:
registry: quay.io
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}

- name: Build and push for Multi-Arch
if: ${{ inputs.multi_arch }}
- name: Build and push multi-arch image for release
if: github.event_name == 'release' && inputs.multi_arch == true
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: quay.io/${{ secrets.QUAY_NAMESPACE }}/${{ inputs.image_name }}:${{ env.IMAGE_TAG }},
quay.io/${{ secrets.QUAY_NAMESPACE }}/${{ inputs.image_name }}:latest

- name: Build and push multi-arch image
if: github.event_name != 'release' && inputs.multi_arch == true
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: "quay.io/${{ secrets.QUAY_NAMESPACE }}/${{ inputs.image_name }}:${{ inputs.image_tag }}"
tags: quay.io/${{ secrets.QUAY_NAMESPACE }}/${{ inputs.image_name }}:${{ env.IMAGE_TAG }}
labels: quay.expires-after=${{ env.QUAY_IMG_EXP }}

0 comments on commit d540f44

Please sign in to comment.