Skip to content

Commit

Permalink
cicd: move to redhat-actions actions for golang image
Browse files Browse the repository at this point in the history
Signed-off-by: Hank Donnay <hdonnay@redhat.com>
  • Loading branch information
hdonnay committed Oct 20, 2022
1 parent f89847c commit 0dfcd3c
Showing 1 changed file with 27 additions and 16 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/golang-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,13 @@
name: Build and publish golang image

on:
workflow_dispatch: {}
workflow_dispatch:
inputs:
force:
description: 'Force a build and push'
required: false
type: boolean
default: false
# Run every day at 5AM UTC
schedule:
- cron: '0 5 * * *'
Expand Down Expand Up @@ -44,31 +50,36 @@ jobs:
run: |
TAG=$(date -d "${TAG_LAST_MODIFIED}" +%s)
GO=$(date -d "${GO_LAST_MODIFIED}" +%s)
if test "$GO" -gt "$TAG"; then
if test "${{ inputs.force }}" = 'true' -o "$GO" -gt "$TAG"; then
echo "BUILD_IMAGE=1" >> "$GITHUB_ENV"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@master
with:
platforms: all
if: env.BUILD_IMAGE == 1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build
uses: redhat-actions/buildah-build@v2
if: env.BUILD_IMAGE == 1
- uses: docker/login-action@v2
with:
platforms: linux/amd64,linux/arm64
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
containerfiles: etc/Dockerfile
context: etc
tags: |
quay.io/${{ env.QUAY_ORG }}/${{ env.QUAY_REPO }}:${{ matrix.go }}
- uses: redhat-actions/podman-login@v1
if: env.BUILD_IMAGE == 1
with:
registry: quay.io
username: ${{ env.QUAY_USER }}
password: ${{ secrets.QUAY_TOKEN }}
- name: Build and Publish golang image
uses: docker/build-push-action@v3
- name: Publish
uses: redhat-actions/push-to-registry@v2
if: env.BUILD_IMAGE == 1
with:
build-args: |
GO_VERSION=${{ env.GO_VERSION }}
context: etc
platforms: linux/amd64,linux/arm64
push: true
#extra-args: |
# --compression-format=zstd:chunked
tags: |
quay.io/${{ env.QUAY_ORG }}/${{ env.QUAY_REPO }}:${{ matrix.go }}
if: env.BUILD_IMAGE == 1

0 comments on commit 0dfcd3c

Please sign in to comment.