Skip to content

Commit

Permalink
Merge pull request #73 from husarion/2.0.3-20240606
Browse files Browse the repository at this point in the history
Release 2.0.3 to ros2
  • Loading branch information
github-actions[bot] committed Jun 7, 2024
2 parents 049b375 + 8259fc4 commit 3d54bd7
Show file tree
Hide file tree
Showing 6 changed files with 90 additions and 62 deletions.
17 changes: 17 additions & 0 deletions .coderabbit.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json
language: "en-US"
early_access: false
reviews:
profile: "chill"
request_changes_workflow: false
high_level_summary: true
poem: false
review_status: true
collapse_walkthrough: false
auto_review:
enabled: true
drafts: false
base_branches:
- "ros2-devel"
chat:
auto_reply: true
23 changes: 23 additions & 0 deletions .github/workflows/protect-default-branch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Validate PR head branch
on:
pull_request:
branches:
- "ros2"

jobs:
check-head-branch:
runs-on: ubuntu-latest
steps:
- name: Check allowed branches
run: |
pattern="^[0-9]+\.[0-9]+\.[0-9]+-[0-9]{8}$" # This regex matches the X.X.X-YYYYMMDD pattern
if [[ "${{ github.head_ref }}" == *"hotfix"* ]]; then
echo "PR from a branch containing 'hotfix' is allowed."
exit 0
elif [[ "${{ github.head_ref }}" =~ $pattern ]]; then
echo "PR from a branch matching X.X.X-YYYYMMDD pattern is allowed."
exit 0
else
echo "PRs must come from branches containing 'hotfix' phrase or matching X.X.X-YYYYMMDD pattern."
exit 1
fi
104 changes: 46 additions & 58 deletions .github/workflows/release-repository.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ name: Release repository
on:
workflow_dispatch:
inputs:
target_branch:
description: Target branch for the release.
release_candidate:
description: Branch name of the release candidate.
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.
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:
Expand All @@ -32,71 +30,49 @@ jobs:
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 }}-stable
MAIN_BRANCH: ros2
DEVEL_BRANCH: ros2-devel
steps:
- name: Checkout
- name: Checkout to main branch
if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}

- name: Update docker image version
uses: mikefarah/[email protected]
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: [email protected]
new_branch: ${{ env.RELEASE_BRANCH }}
ref: ${{ env.MAIN_BRANCH }}
fetch-depth: 0

- name: Create pull request
- name: Get git diff between main and release candidate
id: git_diff
run: |
gh pr create \
--base ${{ github.event.inputs.target_branch }} \
--head $RELEASE_BRANCH \
--title "Release ${{ github.event.inputs.version }}" \
--body "This PR incorporates tag(s) update in docker compose files."
git fetch origin ${{ github.event.inputs.release_candidate }}:${{ github.event.inputs.release_candidate }}
DIFF=$(git diff --name-only ${{ github.event.inputs.release_candidate }}) # Change to "master.." to diff against last common commit
if [ -z "$DIFF" ]; then
echo "DIFF=false" >> $GITHUB_ENV
else
echo "DIFF=true" >> $GITHUB_ENV
fi
- name: Merge pull request
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true }}
run: |
gh pr merge $RELEASE_BRANCH \
--merge --delete-branch
- name: Checkout to main
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode)
== true }}
uses: actions/checkout@v4
with:
ref: ${{ env.MAIN_BRANCH }}

- name: Create pull request to main
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode)
== true }}
- name: Create PR to main branch
if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && env.DIFF == 'true' }}
run: |
gh pr create \
--base ${{ env.MAIN_BRANCH }} \
--head ${{ github.event.inputs.target_branch }} \
--title "Release ${{ steps.create_release_candidate.outputs.version}} to ${{ env.MAIN_BRANCH }}" \
--body "This PR incorporates tag(s) update in docker compose files."
--head ${{ github.event.inputs.release_candidate }} \
--title "Release ${{ github.event.inputs.version}} to ${{ env.MAIN_BRANCH }}" \
--body "This PR incorporates release updates."
- name: Merge pull request to main
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode)
== true }}
- name: Merge PR to main branch
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && github.event.inputs.release_candidate != env.MAIN_BRANCH && env.DIFF == 'true' }}
run: |
gh pr merge ${{ github.event.inputs.target_branch }} \
gh pr merge ${{ github.event.inputs.release_candidate }} \
--merge --delete-branch
- name: Delete branch
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && github.event.inputs.release_candidate != env.MAIN_BRANCH && env.DIFF == 'false' }}
run: |
git push origin --delete ${{ github.event.inputs.release_candidate }}
- name: Create prerelease
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
== true}}
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) == true}}
run: |
gh release create ${{ github.event.inputs.version }} \
--target ${{ env.MAIN_BRANCH }} \
Expand All @@ -105,10 +81,22 @@ jobs:
--prerelease
- name: Create release
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
== false}}
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) == false}}
run: |
gh release create ${{ github.event.inputs.version }} \
--target ${{ env.MAIN_BRANCH }} \
--title ${{ github.event.inputs.release_name }} \
--generate-notes
- name: Checkout to devel branch
if: ${{ env.DEVEL_BRANCH != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) == true }}
uses: actions/checkout@v4
with:
ref: ${{ env.DEVEL_BRANCH }}
fetch-depth: 0

- name: Update devel branch
if: ${{ env.DEVEL_BRANCH != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) == true }}
run: |
git pull origin ${{ env.MAIN_BRANCH }}
git push origin ${{ env.DEVEL_BRANCH }}
4 changes: 2 additions & 2 deletions .github/workflows/update-tags-in-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Update tags in compose files
on:
workflow_dispatch:
inputs:
target_branch:
branch_name:
description: Target branch for the update.
required: true
image_tag:
Expand All @@ -21,7 +21,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}
ref: ${{ github.event.inputs.branch_name }}

- name: Update docker image tag
uses: mikefarah/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion demo/compose.minimal-setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ x-common-config: &common-config
- ROS_DOMAIN_ID=${ROS_DOMAIN_ID:-0}
services:
panther_ros:
image: husarion/panther:humble-2.0.2-20240605-stable
image: husarion/panther:humble-2.0.3-20240606
container_name: panther_ros
<<: *common-config
devices:
Expand Down
2 changes: 1 addition & 1 deletion demo/compose.simulation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ x-gpu-config: &gpu-config
env_file: .env.gpu
services:
panther_gazebo:
image: husarion/panther-gazebo:humble-2.0.2-20240605-stable
image: husarion/panther-gazebo:humble-2.0.3-20240606
container_name: panther_gazebo
<<:
- *common-config
Expand Down

0 comments on commit 3d54bd7

Please sign in to comment.