Skip to content

Release repository

Release repository #52

---
name: Release repository
on:
workflow_dispatch:
inputs:
source_branch:
description: Source branch for the release.
required: true
target_branch:
description: Target branch for the release.
required: false
default: ros2
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.source_branch }}
- name: Catkin release
id: catkin_release
uses: at-wat/catkin-release-action@v1
with:
version: ${{ github.event.inputs.version }}
git_user: action-bot
git_email: action-bot@action-bot.com
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Create PR
run: |
gh pr create \
--base ${{ github.event.inputs.source_branch }} \
--head ${{ steps.catkin_release.outputs.created_branch }} \
--title "Release ${{ steps.catkin_release.outputs.version}}" \
--body "This PR incorporates package(s) version and changelog update."
- name: Merge PR
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true }}
run: |
gh pr merge ${{ steps.catkin_release.outputs.created_branch }} \
--merge --delete-branch
- name: Checkout to target branch
if: ${{ github.event.inputs.source_branch != github.event.inputs.target_branch && fromJSON(inputs.automatic_mode)
== true }}
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.target_branch }}
- name: Create PR to target branch
if: ${{ github.event.inputs.source_branch != github.event.inputs.target_branch && fromJSON(inputs.automatic_mode)
== true }}
run: |
gh pr create \
--base ${{ github.event.inputs.target_branch }} \
--head ${{ github.event.inputs.source_branch }} \
--title "Release ${{ steps.catkin_release.outputs.version}} to ${{ github.event.inputs.target_branch }}" \
--body "This PR incorporates package(s) version and changelog update."
- name: Merge PR to target branch
if: ${{ github.event.inputs.source_branch != github.event.inputs.target_branch && fromJSON(inputs.automatic_mode)
== true }}
run: |
gh pr merge ${{ github.event.inputs.source_branch }} \
--merge --delete-branch
- name: Create prerelease
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
== true}}
run: |
gh release create ${{ steps.catkin_release.outputs.version }} \
--target ${{ github.event.inputs.target_branch }} \
--title ${{ github.event.inputs.release_name }} \
--generate-notes \
--prerelease
- name: Create release
if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease)
== false}}
run: |
gh release create ${{ steps.catkin_release.outputs.version }} \
--target ${{ github.event.inputs.target_branch }} \
--title ${{ github.event.inputs.release_name }} \
--generate-notes