|
| 1 | +name: bump-version-pr |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + version_part: |
| 7 | + description: Which part of the version number to bump? |
| 8 | + required: true |
| 9 | + default: minor |
| 10 | + type: choice |
| 11 | + options: |
| 12 | + - major |
| 13 | + - minor |
| 14 | + - patch |
| 15 | + |
| 16 | +jobs: |
| 17 | + bump-version-pr: |
| 18 | + runs-on: ubuntu-22.04 |
| 19 | + steps: |
| 20 | + - name: Check out repository |
| 21 | + uses: actions/checkout@v4 |
| 22 | + with: |
| 23 | + ref: humble |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Generate token |
| 27 | + id: generate-token |
| 28 | + uses: actions/create-github-app-token@v1 |
| 29 | + with: |
| 30 | + app-id: ${{ secrets.APP_ID }} |
| 31 | + private-key: ${{ secrets.PRIVATE_KEY }} |
| 32 | + |
| 33 | + - name: Set git config |
| 34 | + uses: autowarefoundation/autoware-github-actions/set-git-config@v1 |
| 35 | + with: |
| 36 | + token: ${{ steps.generate-token.outputs.token }} |
| 37 | + |
| 38 | + - name: Setup Python 3.x |
| 39 | + uses: actions/setup-python@v5 |
| 40 | + with: |
| 41 | + python-version: 3.x |
| 42 | + |
| 43 | + - name: Install dependencies |
| 44 | + run: pip3 install -U catkin_tools |
| 45 | + shell: bash |
| 46 | + |
| 47 | + - name: Bump version from humble branch |
| 48 | + id: bump-version-from-humble-branch |
| 49 | + run: | |
| 50 | + git checkout -b tmp/bot/bump_version_base |
| 51 | + git fetch origin main |
| 52 | + git merge origin/main |
| 53 | + catkin_generate_changelog -y |
| 54 | + git add * |
| 55 | + git commit -m "update CHANGELOG.rst" |
| 56 | + catkin_prepare_release -y --bump ${{ inputs.version_part }} --no-push |
| 57 | + version=$(git describe --tags) |
| 58 | + echo "version=${version}" >> $GITHUB_OUTPUT |
| 59 | + shell: bash |
| 60 | + |
| 61 | + - name: Create target branch |
| 62 | + run: | |
| 63 | + git checkout origin/main |
| 64 | + git checkout -b chore/bot/bump_version |
| 65 | + git merge tmp/bot/bump_version_base |
| 66 | + git push origin chore/bot/bump_version --force |
| 67 | + shell: bash |
| 68 | + |
| 69 | + - name: Create PR |
| 70 | + id: create-pr |
| 71 | + run: > |
| 72 | + gh |
| 73 | + pr |
| 74 | + create |
| 75 | + --base=main |
| 76 | + --body="Bump version to ${{ steps.bump-version-from-humble-branch.outputs.version }}" |
| 77 | + --title="chore: bump version to ${{ steps.bump-version-from-humble-branch.outputs.version }}" |
| 78 | + --head=chore/bot/bump_version |
| 79 | + env: |
| 80 | + GH_TOKEN: ${{ steps.generate-token.outputs.token }} |
0 commit comments