Skip to content

fix: sync to x replace fuser with mtime check #163

fix: sync to x replace fuser with mtime check

fix: sync to x replace fuser with mtime check #163

name: Build and Push Docker Images
on:
push:
branches:
- develop/r36.4.0
pull_request:
branches:
- develop/r36.4.0
release:
types: [published]
env:
REGISTRY: ghcr.io
jobs:
build-and-push:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
include:
- build_dir: docker/runtime
local_image: tier4/pkg-drs-runtime:latest
ghcr_image: ghcr.io/tier4/pkg-drs-runtime
needs_vcs_import: true
- build_dir: docker/calibration
local_image: tier4/pkg-drs-calibration:latest
ghcr_image: ghcr.io/tier4/pkg-drs-calibration
needs_vcs_import: false
- build_dir: docker/ros2_bridge
local_image: tier4/drs-ros2-bridge:latest
ghcr_image: ghcr.io/tier4/pkg-drs-ros2-bridge
needs_vcs_import: true
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Import external repositories
if: matrix.needs_vcs_import
run: |
pip install vcstool
# Remove extraheader set by actions/checkout (uses GITHUB_TOKEN which
# only has access to this repo, not external private repos)
git config --unset-all http.https://github.com/.extraheader || true
./scripts/setup_repos.sh --token "${{ secrets.DRS_PAT }}"
- name: Log in to Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker image using build.sh
working-directory: ${{ matrix.build_dir }}
run: ./build.sh --colcon-parallel-workers 2
- name: Determine image tags
id: tags
run: |
GHCR_IMAGE="${{ matrix.ghcr_image }}"
TAGS=""
if [[ "${{ github.event_name }}" == "release" ]]; then
# For GitHub releases (e.g., v1.0.0)
TAG_NAME="${{ github.event.release.tag_name }}"
TAGS="${GHCR_IMAGE}:${TAG_NAME}"
else
# For pushes to main branch
TAGS="${GHCR_IMAGE}:latest"
fi
echo "tags=${TAGS}" >> "$GITHUB_OUTPUT"
- name: Tag and push Docker image
if: github.event_name != 'pull_request'
run: |
IFS=',' read -ra TAG_ARRAY <<< "${{ steps.tags.outputs.tags }}"
for TAG in "${TAG_ARRAY[@]}"; do
docker tag "${{ matrix.local_image }}" "${TAG}"
docker push "${TAG}"
done