Skip to content

Release repository

Release repository #28

---
name: Release repository
on:
workflow_dispatch:
inputs:
release_candidate:
description: Branch name of the release candidate.
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 }}
MAIN_BRANCH: ros2
DEVEL_BRANCH: ros2-devel
steps:
# - name: Checkout to rc branch
# uses: actions/checkout@v4
# with:
# ref: ${{ github.event.inputs.release_candidate }}
# - 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: [email protected]
# github_token: ${{ secrets.GITHUB_TOKEN }}
# - name: Catkin release - create PR
# run: |
# gh pr create \
# --base ${{ github.event.inputs.release_candidate }} \
# --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: Catkin release - 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 main branch
if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode)
== true }}
uses: actions/checkout@v4
with:
ref: ${{ env.MAIN_BRANCH }}
fetch-depth: 0
# - name: Create PR to main branch
# if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode)
# == true }}
# run: |
# gh pr create \
# --base ${{ env.MAIN_BRANCH }} \
# --head ${{ github.event.inputs.release_candidate }} \
# --title "Release ${{ steps.catkin_release.outputs.version}} to ${{ env.MAIN_BRANCH }}" \
# --body "This PR incorporates package(s) version and changelog update."
# - name: Merge PR to main branch
# if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode)
# == true }}
# run: |
# gh pr merge ${{ github.event.inputs.release_candidate }} \
# --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 ${{ env.MAIN_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 2.0.3 \
--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 }}