Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 28 additions & 5 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@ name: Build and Publish Multi-Arch Docker Image

on:
push:
branches: [ main, development ]
branches: [ development ]
pull_request:
branches: [ main, development ]
release:
types: [published]
workflow_dispatch:
inputs:
platforms:
description: 'Platforms to build (comma-separated)'
default: 'linux/amd64,linux/arm64,linux/arm/v7'
required: false
type: string
release_tag:
description: 'Release version tag (e.g., 1.2.3). If provided, also tags as latest.'
required: false
type: string

jobs:
build:
Expand All @@ -31,18 +37,35 @@ jobs:
uses: docker/setup-buildx-action@v3

- name: Login to GHCR
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ secrets.GHCR_USERNAME }}
password: ${{ secrets.GHCR_TOKEN }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/autonomy-logic/openplc-runtime
tags: |
# latest tag for releases or manual runs with release_tag
type=raw,value=latest,enable=${{ github.event_name == 'release' || inputs.release_tag != '' }}
# SHA tag for branch pushes
type=sha,enable=${{ github.event_name == 'push' }}
# Version tag for releases (e.g., v1.2.3 -> 1.2.3)
type=semver,pattern={{version}}
# Version tag for manual runs with release_tag
type=raw,value=${{ inputs.release_tag }},enable=${{ inputs.release_tag != '' }}
# development tag for development branch
type=raw,value=development,enable=${{ github.ref == 'refs/heads/development' }}

- name: Build and Push Multi-Arch Image
uses: docker/build-push-action@v6
with:
context: .
push: true
push: ${{ github.event_name != 'pull_request' }}
platforms: ${{ inputs.platforms || 'linux/amd64,linux/arm64,linux/arm/v7' }}
tags: |
ghcr.io/autonomy-logic/openplc-runtime:latest
ghcr.io/autonomy-logic/openplc-runtime:${{ github.sha }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
Loading