Keep master on PX4 main #59
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: Publish Docker | |
on: | |
push: | |
branches: | |
- 'master' | |
tags: | |
- 'v*' | |
pull_request: | |
branches: | |
- '*' | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout repository | |
- uses: actions/checkout@v3 | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
# https://github.com/docker/setup-buildx-action | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v2 | |
# https://github.com/marketplace/actions/docker-login | |
- name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v2 | |
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@v4 | |
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@v3 | |
with: | |
# 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 }} |