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: 22 additions & 11 deletions .github/workflows/dev_container.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Container build

on:
Expand All @@ -10,19 +9,26 @@ on:
- 'release/**'
tags:
- 'v*'
paths:
- 'Tools/setup/ubuntu.sh'
- 'Tools/setup/requirements.txt'
- 'Tools/setup/Dockerfile'
- 'Tools/setup/docker-entrypoint.sh'
pull_request:
branches:
- '*'
paths:
- '.github/workflows/dev_container.yml'
- 'Tools/setup/ubuntu.sh'
- 'Tools/setup/requirements.txt'
- 'Tools/setup/Dockerfile'
- '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:
setup:
Expand All @@ -42,10 +48,15 @@ jobs:
submodules: false
fetch-depth: 0

# If manual dispatch, take the user‐provided input
- name: Set PX4 Tag Version
id: px4_version
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
id: meta
Expand Down Expand Up @@ -83,14 +94,14 @@ jobs:

- name: Login to Docker Hub
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:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
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:
registry: ghcr.io
username: ${{ github.actor }}
Expand All @@ -113,7 +124,7 @@ jobs:
labels: ${{ needs.setup.outputs.meta_labels }}
platforms: ${{ matrix.platform }}
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
cache-from: type=gha,version=1
cache-to: type=gha,version=1,mode=max
Expand All @@ -125,7 +136,7 @@ jobs:
packages: write
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]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
if: ${{ startsWith(github.ref, 'refs/tags/') || (github.event_name == 'workflow_dispatch' && github.event.inputs.deploy_to_registry) }}
steps:
- uses: runs-on/action@v1
- uses: actions/checkout@v4
Expand Down