mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-11-09 15:41:35 +08:00
build docker images on: * every pull request * push to master * stable release published pushes to registry if: * is not a pull request * is master branch * tag as 'latest' * is the result of release * tag with release name
50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
# Build docker image
|
|
# Always builds by default
|
|
# Only pushes to registry if:
|
|
# * is not a pull request
|
|
# * is master branch
|
|
# * tag as 'latest'
|
|
# * is the result of release
|
|
# * tag with release name
|
|
|
|
name: Build docker
|
|
|
|
on:
|
|
release:
|
|
types: [released]
|
|
push:
|
|
branches:
|
|
- 'main'
|
|
pull_request:
|
|
|
|
jobs:
|
|
build-docker:
|
|
name: Build Docker image
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Login to Github Registry
|
|
uses: docker/login-action@v1
|
|
if: github.event_name == 'push'
|
|
with:
|
|
registry: ghrc.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build image
|
|
uses: docker/build-push-action@v2
|
|
id: docker_build
|
|
with:
|
|
file: Tools/setup/Dockerfile
|
|
push: github.event_name != 'pull_request'
|
|
tags: px4io/px4-dev:${{ github.event_name == 'push' && github.event.release.name || 'latest' }}
|
|
|
|
- name: Push to Github Registry
|
|
uses: docker/build-push-action@v2
|
|
if: github.event_name == 'push'
|
|
|
|
- name: Image Digest
|
|
run: echo ${{ steps.docker_build.outputs.digest }}
|