mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 06:13:35 +08:00
ci: build px4-dev containers on demand
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
committed by
Alexander Lerach
parent
cadf69f73c
commit
4e8760097d
@@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
name: Container build
|
name: Container build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
@@ -10,19 +9,26 @@ on:
|
|||||||
- 'release/**'
|
- 'release/**'
|
||||||
tags:
|
tags:
|
||||||
- 'v*'
|
- 'v*'
|
||||||
paths:
|
|
||||||
- 'Tools/setup/ubuntu.sh'
|
|
||||||
- 'Tools/setup/requirements.txt'
|
|
||||||
- 'Tools/setup/Dockerfile'
|
|
||||||
- 'Tools/setup/docker-entrypoint.sh'
|
|
||||||
pull_request:
|
pull_request:
|
||||||
branches:
|
branches:
|
||||||
- '*'
|
- '*'
|
||||||
paths:
|
paths:
|
||||||
|
- '.github/workflows/dev_container.yml'
|
||||||
- 'Tools/setup/ubuntu.sh'
|
- 'Tools/setup/ubuntu.sh'
|
||||||
- 'Tools/setup/requirements.txt'
|
- 'Tools/setup/requirements.txt'
|
||||||
- 'Tools/setup/Dockerfile'
|
- 'Tools/setup/Dockerfile'
|
||||||
- 'Tools/setup/docker-entrypoint.sh'
|
- 'Tools/setup/docker-entrypoint.sh'
|
||||||
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
px4_version:
|
||||||
|
description: 'Container tag (e.g. v1.16.0)'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
deploy_to_registry:
|
||||||
|
description: 'Whether to push built images to the registry'
|
||||||
|
required: false
|
||||||
|
type: boolean
|
||||||
|
default: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
setup:
|
setup:
|
||||||
@@ -42,10 +48,15 @@ jobs:
|
|||||||
submodules: false
|
submodules: false
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# If manual dispatch, take the user‐provided input
|
||||||
- name: Set PX4 Tag Version
|
- name: Set PX4 Tag Version
|
||||||
id: px4_version
|
id: px4_version
|
||||||
run: |
|
run: |
|
||||||
echo "px4_version=$(git describe --tags --match 'v[0-9]*')" >> $GITHUB_OUTPUT
|
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
|
||||||
|
echo "px4_version=${{ github.event.inputs.px4_version }}" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
|
echo "px4_version=$(git describe --tags --match 'v[0-9]*')" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels) for Docker
|
- name: Extract metadata (tags, labels) for Docker
|
||||||
id: meta
|
id: meta
|
||||||
@@ -83,14 +94,14 @@ jobs:
|
|||||||
|
|
||||||
- name: Login to Docker Hub
|
- name: Login to Docker Hub
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_to_registry) }}
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
- name: Login to GitHub Container Registry
|
||||||
uses: docker/login-action@v3
|
uses: docker/login-action@v3
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_to_registry) }}
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
@@ -113,7 +124,7 @@ jobs:
|
|||||||
labels: ${{ needs.setup.outputs.meta_labels }}
|
labels: ${{ needs.setup.outputs.meta_labels }}
|
||||||
platforms: ${{ matrix.platform }}
|
platforms: ${{ matrix.platform }}
|
||||||
load: false
|
load: false
|
||||||
push: ${{ startsWith(github.ref, 'refs/tags/') }}
|
push: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_to_registry) }}
|
||||||
provenance: false
|
provenance: false
|
||||||
cache-from: type=gha,version=1
|
cache-from: type=gha,version=1
|
||||||
cache-to: type=gha,version=1,mode=max
|
cache-to: type=gha,version=1,mode=max
|
||||||
@@ -125,7 +136,7 @@ jobs:
|
|||||||
packages: write
|
packages: write
|
||||||
runs-on: [runs-on,"runner=8cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
|
runs-on: [runs-on,"runner=8cpu-linux-x64","image=ubuntu24-full-x64","run-id=${{ github.run_id }}",spot=false,extras=s3-cache]
|
||||||
needs: [build, setup]
|
needs: [build, setup]
|
||||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_to_registry) }}
|
||||||
steps:
|
steps:
|
||||||
- uses: runs-on/action@v1
|
- uses: runs-on/action@v1
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
Reference in New Issue
Block a user