💚 More Github Action fixes #10
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docker images dev build | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- * | ||
pull_request: | ||
branches: | ||
- main | ||
env: | ||
IMAGE_ORG: 'throwtheswitch' | ||
IMAGE_BASE_NAME: 'madsciencelab' | ||
jobs: | ||
# Jobs organized for concurrent Docker image builds | ||
# Jobs only build :latest images without pushing to Docker Hub | ||
# This is a self-documenting workaround to the limitation that the global `env:` context is not available to jobs' `env:` contexts | ||
prepare-env-vars: | ||
runs-on: ubuntu-latest | ||
steps: | ||
# A step must be present in order to make use of `outputs:` | ||
- run: echo "Setting environment variables shared by jobs..." | ||
outputs: | ||
IMAGE_BASE_NAME: ${{ env.IMAGE_BASE_NAME }} | ||
IMAGE_URL_BASE: ${{ env.IMAGE_ORG }}/${{ env.IMAGE_BASE_NAME }} | ||
madsciencelab: | ||
runs-on: ubuntu-latest | ||
needs: [prepare-env-vars] | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
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 | ||
# Note: standard/ directory maps to madsciencelab image (no variants) | ||
- name: 'Build Docker image ${{ env.IMAGE_BASE_NAME }}' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
file: build/standard/docker/Dockerfile | ||
build-args: | | ||
CONTAINER_VERSION=${{ github.ref_name }} | ||
IMAGE_NAME=${{ env.IMAGE_BASE_NAME }} | ||
tags: ${{ env.IMAGE_URL_BASE }}:latest | ||
madsciencelab-plugins: | ||
runs-on: ubuntu-latest | ||
needs: [prepare-env-vars] | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
env: | ||
VARIANT: 'plugins' | ||
# Cannot reference VARIANT as it does not exist yet | ||
IMAGE_NAME: ${{ env.IMAGE_BASE_NAME }}-plugins | ||
# Cannot reference IMAGE_NAME as it does not exist yet | ||
IMAGE_URL: ${{ env.IMAGE_URL_BASE }}-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 Docker image ${{ env.IMAGE_NAME }}' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
file: build/${{ env.VARIANT }}/docker/Dockerfile | ||
build-args: | | ||
CONTAINER_VERSION=${{ github.ref_name }} | ||
IMAGE_NAME=${{ env.IMAGE_NAME }} | ||
tags: ${{ env.IMAGE_URL }}:latest | ||
madsciencelab-arm-none-eabi: | ||
runs-on: ubuntu-latest | ||
needs: [prepare-env-vars] | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
env: | ||
VARIANT: 'arm-none-eabi' | ||
# Cannot reference VARIANT as it does not exist yet | ||
IMAGE_NAME: ${{ env.IMAGE_BASE_NAME }}-arm-none-eabi | ||
# Cannot reference IMAGE_NAME as it does not exist yet | ||
IMAGE_URL: ${{ env.IMAGE_URL_BASE }}-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 Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
file: build/${{ env.VARIANT }}/docker/Dockerfile | ||
build-args: | | ||
CONTAINER_VERSION=${{ github.ref_name }} | ||
IMAGE_NAME=${{ env.IMAGE_NAME }} | ||
tags: ${{ env.IMAGE_URL }}:latest | ||
madsciencelab-arm-none-eabi-plugins: | ||
runs-on: ubuntu-latest | ||
needs: [prepare-env-vars] | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
env: | ||
VARIANT: 'arm-none-eabi-plugins' | ||
# Cannot reference VARIANT as it does not exist yet | ||
IMAGE_NAME: ${{ env.IMAGE_BASE_NAME }}-arm-none-eabi-plugins | ||
# Cannot reference IMAGE_NAME as it does not exist yet | ||
IMAGE_URL: ${{ env.IMAGE_URL_BASE }}-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 Docker image ${{ env.IMAGE_BASE_NAME }}-${{ env.VARIANT }}' | ||
uses: docker/build-push-action@v6 | ||
with: | ||
platforms: linux/amd64,linux/arm64 | ||
file: build/${{ env.VARIANT }}/docker/Dockerfile | ||
build-args: | | ||
CONTAINER_VERSION=${{ github.ref_name }} | ||
IMAGE_NAME=${{ env.IMAGE_NAME }} | ||
tags: ${{ env.IMAGE_URL }}:latest | ||