-
Notifications
You must be signed in to change notification settings - Fork 10
102 lines (91 loc) · 4.34 KB
/
release-repository.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
---
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 }}
MAIN_BRANCH: ros2
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
- name: Create pull request to main branch
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && github.event.inputs.automatic_mode == true }}
run: |
gh pr create \
--base ${{ env.MAIN_BRANCH }} \
--head ${{ github.event.inputs.target_branch }} \
--title "Release ${{ steps.create_release_candidate.outputs.version}} to main" \
--body "This PR incorporates package(s) version and changelog update."
- name: Checkout to main
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && github.event.inputs.automatic_mode == true }}
uses: actions/checkout@v4
with:
ref: ${{ env.MAIN_BRANCH }}
- name: Merge pull request
if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && github.event.inputs.automatic_mode == true }}
run: |
gh pr merge ${{ github.event.inputs.target_branch }} \
--delete-branch