Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ros2 automatize release process #46

Merged
merged 19 commits into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
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
40 changes: 40 additions & 0 deletions .github/workflows/prepare-test-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Prepare test branch

on:
workflow_dispatch:
inputs:
target_branch:
description: Target branch for the pre-release test.
required: true
test_branch:
description: Test branch name (used as a docker image tag).
required: true

jobs:
release:
name: Release repository
runs-on: ubuntu-22.04
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DOCKER_IMAGE_TAG: humble-${{ github.event.inputs.test_branch }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}

- name: Update docker image version
uses: mikefarah/yq@v4.43.1
with:
cmd: |
yq -i '.services.panther_ros.image = "husarion/panther:${{ env.DOCKER_IMAGE_TAG }}" | (... | select(tag == "!!merge")) tag = ""' demo/compose.minimal-setup.yaml
yq -i '.services.panther_gazebo.image = "husarion/panther-gazebo:${{ env.DOCKER_IMAGE_TAG }}" | (... | select(tag == "!!merge")) tag = ""' demo/compose.simulation.yaml

- name: Commit changes to test branch
uses: EndBug/add-and-commit@v9
with:
message: Update docker image version
author_name: action-bot
author_email: action-bot@action-bot.com
new_branch: ${{ github.event.inputs.test_branch }}
91 changes: 91 additions & 0 deletions .github/workflows/release-repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: Release repository

on:
workflow_dispatch:
inputs:
target_branch:
description: Target branch for the release.
required: true
version:
description: New version (used for tag).
required: true
date:
description: Date stamp of the image to be used in the compose files.
required: true
release_name:
description: Name of the release to be created. Version in the first place is recommended (e.g. `2.0.0-alpha`).
required: true
automatic_mode:
type: boolean
default: false
description: Automatically merge PR and create release.
prerelease:
type: boolean
default: false
description: Mark the release as a prerelease.

jobs:
release:
name: Release repository
runs-on: ubuntu-22.04
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_BRANCH: release-${{ github.event.inputs.version }}
DOCKER_IMAGE_TAG: humble-${{ github.event.inputs.version }}-${{ github.event.inputs.date }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}

- name: Update docker image version
uses: mikefarah/yq@v4.43.1
with:
cmd: |
yq -i '.services.panther_ros.image = "husarion/panther:${{ env.DOCKER_IMAGE_TAG }}" | (... | select(tag == "!!merge")) tag = ""' demo/compose.minimal-setup.yaml
yq -i '.services.panther_gazebo.image = "husarion/panther-gazebo:${{ env.DOCKER_IMAGE_TAG }}" | (... | select(tag == "!!merge")) tag = ""' demo/compose.simulation.yaml

- name: Commit changes to release branch
uses: EndBug/add-and-commit@v9
with:
message: Update docker image version
author_name: action-bot
author_email: action-bot@action-bot.com
new_branch: ${{ env.RELEASE_BRANCH }}

- name: Create pull request
run: |
gh pr create \
--base ${{ github.event.inputs.target_branch }} \
--head $RELEASE_BRANCH \
--title "Release ${{ github.event.inputs.version }}" \
--body "This PR incorporates package(s) version and changelog update."

- name: Merge pull request
if: ${{ github.event.inputs.automatic_mode == true }}
run: |
gh pr merge $RELEASE_BRANCH \
--delete-branch

- name: Create tag
if: ${{ github.event.inputs.automatic_mode == true }}
run: |
git checkout ${{ github.event.inputs.target_branch }}
git tag ${{ github.event.inputs.version }}
git push origin ${{ github.event.inputs.version }}

- name: Create prerelease
if: ${{ github.event.inputs.automatic_mode == true && github.event.inputs.prerelease == true}}
run: |
gh release create ${{ github.event.inputs.version }} \
--title ${{ github.event.inputs.release_name }} \
--notes-from-tag \
--prerelease

- name: Create release
if: ${{ github.event.inputs.automatic_mode == true && github.event.inputs.prerelease == false}}
run: |
gh release create ${{ github.event.inputs.version }} \
--title ${{ github.event.inputs.release_name }} \
--notes-from-tag
123 changes: 59 additions & 64 deletions .github/workflows/ros-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,71 +2,66 @@
name: Build/Publish ROS Docker Image

on:
workflow_dispatch:
inputs:
build_type:
description: Is it a "development" or a "stable" release?
required: true
default: development
type: choice
options:
- development
- stable
target_distro:
description: In case of "stable" release specify the ROS distro of the existing docker image (eg.
humble)
type: string
default: ardent
target_release:
description: In case of "stable" release specify the version of the existing docker image (eg.
1.0.12)
type: string
default: 0.0.0
target_date:
description: In case of "stable" release specify the date of the existing docker image in format
YYYYMMDD (eg. 20220124)
type: string
default: '20131206'
repository_dispatch:
types: [rebuild, ros-package-update]
pull_request:
types:
- closed
- opened
workflow_dispatch:
inputs:
build_type:
description: Is it a "development" or a "stable" release?
required: true
default: development
type: choice
options:
- development
- stable
target_distro:
description:
In case of "stable" release specify the ROS distro of the existing docker image (eg.
humble)
type: string
default: humble
target_release:
description:
In case of "stable" release specify the version of the existing docker image (eg.
1.0.12)
type: string
default: 0.0.0
target_date:
description:
In case of "stable" release specify the date of the existing docker image in format
YYYYMMDD (eg. 20220124)
type: string
default: "20131206"

jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- dockerfile: Dockerfile.hardware
platforms: linux/arm64
ros_distro: humble
- dockerfile: Dockerfile.simulation
repo_name: panther-gazebo
platforms: linux/amd64
ros_distro: humble

include:
- dockerfile: Dockerfile.hardware
platforms: linux/arm64
ros_distro: humble
- dockerfile: Dockerfile.simulation
repo_name: panther-gazebo
platforms: linux/amd64
ros_distro: humble
steps:
- name: Checkout
uses: actions/checkout@v2

steps:

- name: Checkout
uses: actions/checkout@v2

- name: Build Docker Image
uses: husarion-ci/ros-docker-img-action@v0.5
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
main_branch_name: ros2-devel
dockerfile: ${{ matrix.dockerfile }}
repo_name: ${{ matrix.repo_name }}
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros_distro }}
platforms: ${{ matrix.platforms }}
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
target_date: ${{ inputs.target_date }}
- name: Build Docker Image
uses: husarion-ci/ros-docker-img-action@v0.5
with:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_token: ${{ secrets.DOCKERHUB_TOKEN }}
main_branch_name: ros2
dockerfile: ${{ matrix.dockerfile }}
repo_name: ${{ matrix.repo_name }}
build_type: ${{ inputs.build_type }}
ros_distro: ${{ matrix.ros_distro }}
platforms: ${{ matrix.platforms }}
# variables important only for stable release
target_distro: ${{ inputs.target_distro }}
target_release: ${{ inputs.target_release }}
target_date: ${{ inputs.target_date }}
2 changes: 1 addition & 1 deletion Dockerfile.hardware
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update && \
apt-get install -y \
ros-dev-tools && \
# Setup workspace
git clone -b ros2-devel https://github.com/husarion/panther_ros.git src/panther_ros && \
git clone -b ros2 https://github.com/husarion/panther_ros.git src/panther_ros && \
vcs import src < src/panther_ros/panther/panther_hardware.repos && \
cp -r src/ros2_controllers/imu_sensor_broadcaster src && rm -rf src/ros2_controllers && \
# Install dependencies
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile.simulation
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ RUN apt-get update && \
apt-get install -y \
ros-dev-tools && \
# Setup workspace
git clone -b ros2-devel https://github.com/husarion/panther_ros.git src/panther_ros && \
git clone -b ros2 https://github.com/husarion/panther_ros.git src/panther_ros && \
vcs import src < src/panther_ros/panther/panther_hardware.repos && \
vcs import src < src/panther_ros/panther/panther_simulation.repos && \
cp -r src/ros2_controllers/imu_sensor_broadcaster src && rm -rf src/ros2_controllers && \
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Docker images dedicated to Husarion Panther ROS system and simulation.

## Docker Images

Docker images are automatically deployed to Docker Hub. Image tag includes information about the ROS distribution, the version of the [panther_ros](https://github.com/husarion/panther_ros/tree/ros2-devel) repository, and the date of release. Additionally stable image versions are tagged with `stable` and recommended for production use.
Below, you can find a list of available Docker images. To access the latest tag, simply follow provided links:
Docker images are automatically deployed to Docker Hub. The image tag includes information about the ROS distribution, the version of the [panther_ros](https://github.com/husarion/panther_ros/tree/ros2) repository, and the date of release. Additionally, stable image versions are tagged with `stable` and recommended for production use.
Below, you can find a list of available Docker images. To access the latest tag, simply follow the provided links:

- [husarion/panther](https://hub.docker.com/r/husarion/panther) - ROS packages for Panther robot,
- [husarion/panther-gazebo](https://hub.docker.com/r/husarion/panther-gazebo) - Simulation for Panther robot in Gazebo-classic.
Expand Down