adjust for modern outputs in github actions api #22
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: Build and Release Docker Image | |
on: | |
schedule: | |
# 7am UTC, 12am PST | |
- cron: '0 7 * * *' | |
push: | |
# For developer updates to trigger | |
branches: | |
- main | |
jobs: | |
nightly_docker: | |
name: Build and Release Nightly Docker Images From Current Source | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ros_distro: [humble, iron, jazzy, rolling] | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
pull: true | |
tags: ghcr.io/${{ github.repository }}:${{ matrix.ros_distro }}-nightly | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
ROS_DISTRO=${{ matrix.ros_distro }} | |
BUILD=true | |
release_docker: | |
name: Build and Release Current Nav2 Relased Version of Docker Images | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
version: | |
- { ros_distro: 'humble', main_version: '1', distro_version: '1' } | |
- { ros_distro: 'iron', main_version: '1', distro_version: '2' } | |
- { ros_distro: 'jazzy', main_version: '1', distro_version: '3' } | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Tag to Build | |
id: get_tag | |
run: | | |
# Fetch tags from the repository | |
tags=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
https://api.github.com/repos/ros-navigation/navigation2/tags | \ | |
jq -r '.[].name') | |
# Get the filtered set from the release | |
filtered_tags=$(echo "$tags" | grep '^${{ matrix.version.main_version }}\.${{ matrix.version.distro_version }}\.[0-9]*$') | |
# Find the highest tag | |
highest_tag=$(echo "$filtered_tags" | sort -V | tail -n 1) | |
# Output the highest tag | |
echo "Highest tag: $highest_tag" | |
echo "highest_tag=$highest_tag" >> $GITHUB_OUTPUT | |
- name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
push: true | |
pull: true | |
tags: ghcr.io/${{ github.repository }}:${{ matrix.version.ros_distro }}-${{ steps.get_tag.outputs.highest_tag }} | |
platforms: linux/amd64,linux/arm64 | |
build-args: | | |
ROS_DISTRO=${{ matrix.version.ros_distro }} | |
BUILD=true | |
VERSION=${{ steps.get_tag.outputs.highest_tag }} |