Skip to content

Commit

Permalink
replace build-and-publish workflow
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Cho <jason.cho2@ibm.com>
  • Loading branch information
jcho02 committed Dec 1, 2023
1 parent 56b8ad0 commit 5aaa2ff
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions .github/workflows/build-and-publish.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,41 @@
# NOTE: set the REGISTRY secret to your own quay.io account in your fork to
# test this workflow!
---
name: Build and Publish Images

on:
workflow_dispatch:
inputs:
tag:
description: 'Image tag. Defaults to 3.0.2'
required: false
default: "3.0.2"
push:
branches:
- 'main'
tags: # run on any tag that starts with `v` but not tags that end with `-downstream`
- 'v**'
- '!v**-downstream'

jobs:
build-and-publish:
name: Build and Publish
runs-on: ubuntu-latest
env:
TAG: ${{ github.event.inputs.tag || '3.0.2' }}
steps:
- name: Check out code
uses: actions/checkout@v3
# Get the repository's code
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
id: buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
quay.io/project-koku/koku-metrics-operator
tags: |
type=semver,pattern={{raw}}
type=sha,prefix=,enable=${{ github.ref_type == 'tag' }}
# set latest tag for default branch
type=raw,value=latest
type=ref,event=branch
- name: Login to Quay.io
uses: redhat-actions/podman-login@v1
Expand All @@ -31,5 +44,10 @@ jobs:
username: ${{ secrets.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}

- name: Build and Publish
run: make docker-buildx IMG=quay.io/project-koku/koku-metrics-operator:${{ env.TAG }}
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/arm64,linux/amd64,linux/s390x,linux/ppc64le
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit 5aaa2ff

Please sign in to comment.