|
2 | 2 | name: Release repository
|
3 | 3 |
|
4 | 4 | on:
|
5 |
| - workflow_dispatch: |
6 |
| - inputs: |
7 |
| - target_branch: |
8 |
| - description: Target branch for the release. |
9 |
| - required: true |
10 |
| - version: |
11 |
| - description: New version (used for tag and package versioning). |
12 |
| - required: true |
13 |
| - release_name: |
14 |
| - description: Name of the release to be created. Version in the first place is recommended (e.g. `2.0.0-alpha`). |
15 |
| - required: true |
16 |
| - automatic_mode: |
17 |
| - type: boolean |
18 |
| - default: false |
19 |
| - description: Automatically merge PR and create release. |
20 |
| - prerelease: |
21 |
| - type: boolean |
22 |
| - default: false |
23 |
| - description: Mark the release as a prerelease. |
| 5 | + workflow_dispatch: |
| 6 | + inputs: |
| 7 | + release_candidate: |
| 8 | + description: Branch name of the release candidate. |
| 9 | + required: true |
| 10 | + version: |
| 11 | + description: New version (used for tag and package versioning). |
| 12 | + required: true |
| 13 | + release_name: |
| 14 | + description: Name of the release to be created. Version in the first place is recommended (e.g. |
| 15 | + `2.0.0-alpha`). |
| 16 | + required: true |
| 17 | + automatic_mode: |
| 18 | + type: boolean |
| 19 | + default: false |
| 20 | + description: Automatically merge PR and create release. |
| 21 | + prerelease: |
| 22 | + type: boolean |
| 23 | + default: false |
| 24 | + description: Mark the release as a prerelease. |
24 | 25 |
|
25 | 26 | jobs:
|
26 |
| - release: |
27 |
| - name: Release repository |
28 |
| - runs-on: ubuntu-22.04 |
29 |
| - env: |
30 |
| - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
31 |
| - MAIN_BRANCH: ros2 |
32 |
| - steps: |
33 |
| - - name: Checkout |
34 |
| - uses: actions/checkout@v4 |
35 |
| - with: |
36 |
| - ref: ${{ github.event.inputs.target_branch }} |
| 27 | + release: |
| 28 | + name: Release repository |
| 29 | + runs-on: ubuntu-22.04 |
| 30 | + env: |
| 31 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 32 | + MAIN_BRANCH: ros2 |
| 33 | + DEVEL_BRANCH: ros2-devel |
| 34 | + steps: |
| 35 | + - name: Checkout to rc branch |
| 36 | + uses: actions/checkout@v4 |
| 37 | + with: |
| 38 | + ref: ${{ github.event.inputs.release_candidate }} |
37 | 39 |
|
38 |
| - - name: Create release candidate |
39 |
| - id: create_release_candidate |
40 |
| - uses: at-wat/catkin-release-action@v1 |
41 |
| - with: |
42 |
| - version: ${{ github.event.inputs.version }} |
43 |
| - git_user: action-bot |
44 |
| - git_email: action-bot@action-bot.com |
45 |
| - github_token: ${{ secrets.GITHUB_TOKEN }} |
| 40 | + - name: Catkin release |
| 41 | + id: catkin_release |
| 42 | + uses: at-wat/catkin-release-action@v1 |
| 43 | + with: |
| 44 | + version: ${{ github.event.inputs.version }} |
| 45 | + git_user: action-bot |
| 46 | + git_email: action-bot@action-bot.com |
| 47 | + github_token: ${{ secrets.GITHUB_TOKEN }} |
46 | 48 |
|
47 |
| - - name: Create pull request |
48 |
| - run: | |
49 |
| - gh pr create \ |
50 |
| - --base ${{ github.event.inputs.target_branch }} \ |
51 |
| - --head ${{ steps.create_release_candidate.outputs.created_branch }} \ |
52 |
| - --title "Release ${{ steps.create_release_candidate.outputs.version}}" \ |
53 |
| - --body "This PR incorporates package(s) version and changelog update." |
| 49 | + - name: Catkin release - create PR |
| 50 | + run: | |
| 51 | + gh pr create \ |
| 52 | + --base ${{ github.event.inputs.release_candidate }} \ |
| 53 | + --head ${{ steps.catkin_release.outputs.created_branch }} \ |
| 54 | + --title "Release ${{ steps.catkin_release.outputs.version}}" \ |
| 55 | + --body "This PR incorporates package(s) version and changelog update." |
54 | 56 |
|
55 |
| - - name: Merge pull request |
56 |
| - if: ${{ fromJSON(github.event.inputs.automatic_mode) == true }} |
57 |
| - run: | |
58 |
| - gh pr merge ${{ steps.create_release_candidate.outputs.created_branch }} \ |
59 |
| - --merge --delete-branch |
| 57 | + - name: Catkin release - merge PR |
| 58 | + if: ${{ fromJSON(github.event.inputs.automatic_mode) == true }} |
| 59 | + run: | |
| 60 | + gh pr merge ${{ steps.catkin_release.outputs.created_branch }} \ |
| 61 | + --merge --delete-branch |
60 | 62 |
|
61 |
| - - name: Checkout to main |
62 |
| - if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode) == true }} |
63 |
| - uses: actions/checkout@v4 |
64 |
| - with: |
65 |
| - ref: ${{ env.MAIN_BRANCH }} |
| 63 | + - name: Checkout to main branch |
| 64 | + if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) |
| 65 | + == true }} |
| 66 | + uses: actions/checkout@v4 |
| 67 | + with: |
| 68 | + ref: ${{ env.MAIN_BRANCH }} |
66 | 69 |
|
67 |
| - - name: Create pull request to main |
68 |
| - if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode) == true }} |
69 |
| - run: | |
70 |
| - gh pr create \ |
71 |
| - --base ${{ env.MAIN_BRANCH }} \ |
72 |
| - --head ${{ github.event.inputs.target_branch }} \ |
73 |
| - --title "Release ${{ steps.create_release_candidate.outputs.version}} to ${{ env.MAIN_BRANCH }}" \ |
74 |
| - --body "This PR incorporates package(s) version and changelog update." |
| 70 | + - name: Create PR to main branch |
| 71 | + if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) |
| 72 | + == true }} |
| 73 | + run: | |
| 74 | + gh pr create \ |
| 75 | + --base ${{ env.MAIN_BRANCH }} \ |
| 76 | + --head ${{ github.event.inputs.release_candidate }} \ |
| 77 | + --title "Release ${{ steps.catkin_release.outputs.version}} to ${{ env.MAIN_BRANCH }}" \ |
| 78 | + --body "This PR incorporates package(s) version and changelog update." |
75 | 79 |
|
76 |
| - - name: Merge pull request to main |
77 |
| - if: ${{ github.event.inputs.target_branch != env.MAIN_BRANCH && fromJSON(github.event.inputs.automatic_mode) == true }} |
78 |
| - run: | |
79 |
| - gh pr merge ${{ github.event.inputs.target_branch }} \ |
80 |
| - --merge --delete-branch |
| 80 | + - name: Merge PR to main branch |
| 81 | + if: ${{ github.event.inputs.release_candidate != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) |
| 82 | + == true }} |
| 83 | + run: | |
| 84 | + gh pr merge ${{ github.event.inputs.release_candidate }} \ |
| 85 | + --merge --delete-branch |
81 | 86 |
|
82 |
| - - name: Create prerelease |
83 |
| - if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) == true}} |
84 |
| - run: | |
85 |
| - gh release create ${{ steps.create_release_candidate.outputs.version }} \ |
86 |
| - --target ${{ env.MAIN_BRANCH }} \ |
87 |
| - --title ${{ github.event.inputs.release_name }} \ |
88 |
| - --generate-notes \ |
89 |
| - --prerelease |
| 87 | + - name: Create prerelease |
| 88 | + if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) |
| 89 | + == true}} |
| 90 | + run: | |
| 91 | + gh release create ${{ steps.catkin_release.outputs.version }} \ |
| 92 | + --target ${{ env.MAIN_BRANCH }} \ |
| 93 | + --title ${{ github.event.inputs.release_name }} \ |
| 94 | + --generate-notes \ |
| 95 | + --prerelease |
90 | 96 |
|
91 |
| - - name: Create release |
92 |
| - if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) == false}} |
93 |
| - run: | |
94 |
| - gh release create ${{ steps.create_release_candidate.outputs.version }} \ |
95 |
| - --target ${{ env.MAIN_BRANCH }} \ |
96 |
| - --title ${{ github.event.inputs.release_name }} \ |
97 |
| - --generate-notes |
| 97 | + - name: Create release |
| 98 | + if: ${{ fromJSON(github.event.inputs.automatic_mode) == true && fromJSON(github.event.inputs.prerelease) |
| 99 | + == false}} |
| 100 | + run: | |
| 101 | + gh release create ${{ steps.catkin_release.outputs.version }} \ |
| 102 | + --target ${{ env.MAIN_BRANCH }} \ |
| 103 | + --title ${{ github.event.inputs.release_name }} \ |
| 104 | + --generate-notes |
| 105 | +
|
| 106 | + - name: Checkout to devel branch |
| 107 | + if: ${{ env.DEVEL_BRANCH != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) == true }} |
| 108 | + uses: actions/checkout@v4 |
| 109 | + with: |
| 110 | + ref: ${{ env.DEVEL_BRANCH }} |
| 111 | + |
| 112 | + - name: Update devel branch |
| 113 | + if: ${{ env.DEVEL_BRANCH != env.MAIN_BRANCH && fromJSON(inputs.automatic_mode) == true }} |
| 114 | + run: | |
| 115 | + git pull origin ${{ env.MAIN_BRANCH }} |
| 116 | + git push origin ${{ env.DEVEL_BRANCH }} |
0 commit comments