Skip to content

Commit

Permalink
Concurrent Github Action Docker image build jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
mkarlesky committed Oct 2, 2024
1 parent 28db531 commit 0d4f864
Show file tree
Hide file tree
Showing 2 changed files with 93 additions and 9 deletions.
102 changes: 93 additions & 9 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ on:
branches:
- 'main'

env:
IMAGE_BASE_NAME: 'throwtheswitch/madsciencelab'


jobs:
build-and-push-images:
# Jobs organized for concurrent Docker image builds

madsciencelab:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
IMAGE_BASE_NAME: 'throwtheswitch/madsciencelab'

steps:
- name: 'Checkout GitHub Action'
Expand All @@ -40,6 +44,8 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker image: madsciencelab
# Note: standard/ directory maps to madsciencelab image (no variants)
- name: 'Build and push Docker image ${{ env.IMAGE_BASE_NAME }}:${{ github.ref_name }}'
uses: docker/build-push-action@v6
with:
Expand All @@ -49,9 +55,35 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.IMAGE_BASE_NAME }}:${{ github.ref_name }}, ${{ env.IMAGE_BASE_NAME }}:latest

madsciencelab-plugins:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
VARIANT: plugins

steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

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

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

- name: 'Login to Docker Hub'
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker image: madsciencelab-plugins
- name: 'Build and push Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}'
env:
VARIANT: plugins
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
Expand All @@ -60,9 +92,35 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}, ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest

madsciencelab-arm-none-eabi:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
VARIANT: arm-none-eabi

steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

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

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

- name: 'Login to Docker Hub'
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker image: madsciencelab-arm-none-eabi
- name: 'Build and push Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}'
env:
VARIANT: arm-none-eabi
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
Expand All @@ -71,9 +129,35 @@ jobs:
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}, ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:latest

madsciencelab-arm-none-eabi-plugins:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
env:
VARIANT: arm-none-eabi-plugins

steps:
- name: 'Checkout GitHub Action'
uses: actions/checkout@v4

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

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

- name: 'Login to Docker Hub'
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

# Docker image: madsciencelab-arm-none-eabi-plugins
- name: 'Build and push Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}:${{ github.ref_name }}'
env:
VARIANT: arm-none-eabi-plugins
uses: docker/build-push-action@v6
with:
platforms: linux/amd64,linux/arm64
Expand Down
Empty file removed build/README.md
Empty file.

0 comments on commit 0d4f864

Please sign in to comment.