Skip to content

Publish Docker

Publish Docker #72

Workflow file for this run

name: Publish Docker
on:
push:
branches:
- 'master'
tags:
- 'v*'
pull_request:
branches:
- '*'
jobs:
main:
runs-on: ubuntu-latest
steps:
# Checkout repository
- uses: actions/checkout@v4
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
# https://github.com/marketplace/actions/docker-login
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
# https://github.com/marketplace/actions/docker-metadata-action
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
jonasvautherin/px4-gazebo-headless
# Configure tags:
# `master` branch -> `latest`
# `v{xx.yy.zz}` tag -> `{xx.yy.zz}`
tags: |
type=raw,value=latest,enable={{is_default_branch}}
type=semver,pattern={{version}}
# https://github.com/marketplace/actions/build-and-push-docker-images
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
# Supported platforms
platforms: linux/amd64,linux/arm64/v8
# Do not push for pull requests
push: ${{ github.event_name != 'pull_request' }}
# Tags and labels defined in `meta` step
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}