Skip to content

Commit

Permalink
Update docker workflow to try building on validate
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaron Reisman committed Oct 21, 2024
1 parent ac8c090 commit 96e5022
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 9 deletions.
47 changes: 38 additions & 9 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,39 @@ on:
type: string
description: 'Version number'
required: true
release:
type: boolean
description: 'Is this a release build?'
required: true
secrets:
docker_username:
required: true
docker_token:
required: true

env:
DOCKER_IMAGE: ${{ secrets.docker_username }}/libation

jobs:
docker:
configure:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

build_and_push:
runs-on: ubuntu-latest
needs: configure
strategy:
# Prevent a failure in one image from stopping the other builds
fail-fast: false
matrix:
os:
- ubuntu-latest
arch:
- amd64
- arm64
steps:
- name: Checkout
uses: actions/checkout@v4

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

Expand All @@ -38,9 +55,21 @@ jobs:
username: ${{ secrets.docker_username }}
password: ${{ secrets.docker_token }}

- name: Build and push
uses: docker/build-push-action@v5
- name: Generate docker image tags
id: metadata
uses: docker/metadata-action@v5
with:
flavor: |
latest=true
images: |
name=${{ secrets.docker_username }}/libation
tags: |
type=raw,value=${{ inputs.version }},enable=${{ inputs.release }}
- name: Build and push image
uses: docker/build-push-action@v6
with:
push: true
build-args: 'FOLDER_NAME=Linux-chardonnay'
tags: ${{ env.DOCKER_IMAGE }}:latest,${{ env.DOCKER_IMAGE }}:${{ inputs.version }}
platforms: ${{ matrix.arch }}
push: ${{ steps.metadata.outputs.tags != ''}}
tags: ${{ steps.metadata.outputs.tags }}
labels: ${{ steps.metadata.outputs.labels }}
1 change: 1 addition & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
uses: ./.github/workflows/docker.yml
with:
version: ${{ needs.prerelease.outputs.version }}
release: true
secrets:
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@ on:
jobs:
build:
uses: ./.github/workflows/build.yml
docker:
uses: ./.github/workflows/docker.yml
with:
version: ${GITHUB_SHA}
release: false
secrets:
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
docker_token: ${{ secrets.DOCKERHUB_TOKEN }}

0 comments on commit 96e5022

Please sign in to comment.