diff --git a/.github/workflows/prepare-test-branch.yaml b/.github/workflows/prepare-test-branch.yaml new file mode 100644 index 0000000..f355d6c --- /dev/null +++ b/.github/workflows/prepare-test-branch.yaml @@ -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 }} diff --git a/.github/workflows/release-repository.yaml b/.github/workflows/release-repository.yaml new file mode 100644 index 0000000..1d3f289 --- /dev/null +++ b/.github/workflows/release-repository.yaml @@ -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 diff --git a/.github/workflows/ros-docker-image.yaml b/.github/workflows/ros-docker-image.yaml index 8d46ff7..08cdcda 100644 --- a/.github/workflows/ros-docker-image.yaml +++ b/.github/workflows/ros-docker-image.yaml @@ -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 }} diff --git a/Dockerfile.hardware b/Dockerfile.hardware index dc5d48f..e6533ac 100644 --- a/Dockerfile.hardware +++ b/Dockerfile.hardware @@ -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 diff --git a/Dockerfile.simulation b/Dockerfile.simulation index 3c8bb3f..29b8459 100644 --- a/Dockerfile.simulation +++ b/Dockerfile.simulation @@ -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 && \ diff --git a/README.md b/README.md index 3747345..9ba248d 100644 --- a/README.md +++ b/README.md @@ -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.