Skip to content

Commit

Permalink
Ros2 automatize release process (#25)
Browse files Browse the repository at this point in the history
* Add release repository workflow

* Add pr event trigger

* Update husarion ci action name

* Update changelog

* 2.0.1

* Update releasing action version

* Bump action version

* Debug release action

* Change checkout version

* Test old version

* get rid of spatial args

* Update changelog

* 2.1.0

* Revert changes in changelog

* Test different workflow

* Replace PR action

* test action

* determine base

* gh cli

* add github token env

* break a line

* Finalize workflow

* pull request trigger

* Remove PR trigger

* Add create tag step

* Fix and operator and register workflow

* Remove PR trigger

* Update inputs

---------

Co-authored-by: action-bot <[email protected]>
  • Loading branch information
pawelirh and action-bot authored Apr 29, 2024
1 parent 52a0aed commit 1321d92
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 1 deletion.
80 changes: 80 additions & 0 deletions .github/workflows/release-repository.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
name: Release repository

on:
workflow_dispatch:
inputs:
target_branch:
description: Target branch for the release.
required: true
version:
description: New version (used for tag and package versioning).
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 }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}

- name: Create release candidate
id: create_release_candidate
uses: at-wat/catkin-release-action@v1
with:
version: ${{ github.event.inputs.version }}
git_user: action-bot
git_email: [email protected]
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Create pull request
run: |
gh pr create \
--base ${{ github.event.inputs.target_branch }} \
--head ${{ steps.create_release_candidate.outputs.created_branch }} \
--title "Release ${{ steps.create_release_candidate.outputs.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 ${{ steps.create_release_candidate.outputs.created_branch }} \
--delete-branch
- name: Create tag
if: ${{ github.event.inputs.automatic_mode == true }}
run: |
git checkout ${{ github.event.inputs.target_branch }}
git tag ${{ steps.create_release_candidate.outputs.version }}
git push origin ${{ steps.create_release_candidate.outputs.version }}
- name: Create prerelease
if: ${{ github.event.inputs.automatic_mode == true && github.event.inputs.prerelease == true}}
run: |
gh release create ${{ steps.create_release_candidate.outputs.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 ${{ steps.create_release_candidate.outputs.version }} \
--title ${{ github.event.inputs.release_name }} \
--notes-from-tag
2 changes: 1 addition & 1 deletion package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>panther_msgs</name>
<version>2.0.0</version>
<version>2.1.0</version>
<description>Custom messages for Panther robot.</description>
<maintainer email="[email protected]">Husarion</maintainer>
<license>Apache License 2.0</license>
Expand Down

0 comments on commit 1321d92

Please sign in to comment.