Skip to content

Create Release PR

Create Release PR #42

# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ** Release preparation **
#
# This workflow create 2 pull requests branching from develop into:
# - master
# - develop
#
# The pull request contains:
# - Bump release version -> .env
# - ..
#
name: Create Release PR
on:
workflow_dispatch:
inputs:
versionCode:
description: 'Version Code - [Format: "Major.Minor.Patch", Example: "3.12.1]"'
required: true
jobs:
createRelease_01:
name: Create Pull Request to master
runs-on: ubuntu-latest
# Only create release branch in case the version number is valid
if: '[[ ${{ github.event.inputs.versionCode }} =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]'
steps:
- uses: actions/checkout@v4
# The changes here will be overwritten, however we need changes, else the PR will be automatically closed by GitHub
- name: Dummy Changes to keep PR open
run: |
echo "Dummy Change" >> .env
- name: Create Pull Request to main branch
id: cpr-main
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Prepare release v${{ github.event.inputs.versionCode }}
committer: Catrobot <[email protected]>
title: 'Release v${{ github.event.inputs.versionCode }} into master'
body: |
### Release v${{ github.event.inputs.versionCode }}
Release ToDo List:
- [X] Bump our version code
- [ ] Update Changelog
- [ ] Create new Release/Tag on GitHub
This pull request is autogenerated using GitHub Actions.
For more information checkout the action '.github/workflows/create_release_pull_request.yaml'
labels: automated, new-release, master
branch: release/v${{ github.event.inputs.versionCode }}
delete-branch: true
reviewers: dmetzner
base: master
createRelease_02:
#
# We have to define all of our modification in this job since the create-PR-Action uses force push and
# overwrites all previous changes to the code base.
#
name: Create Pull Request to develop
runs-on: ubuntu-latest
needs: createRelease_01
steps:
- uses: actions/checkout@v4
- name: Set Version Code
run: |
sed -i -E "s/APP_VERSION='[0-9]+\.[0-9]+\.[0-9]+'/APP_VERSION='${{ github.event.inputs.versionCode }}'/" .env
- name: Create Pull Request to develop branch
id: cpr-develop
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Prepare release v${{ github.event.inputs.versionCode }}
committer: Catrobot <[email protected]>
title: 'Release v${{ github.event.inputs.versionCode }} into develop'
body: |
### Release v${{ github.event.inputs.versionCode }}
Release ToDo List:
- [X] Bump our version code
- [ ] Update Changelog
- [ ] Create new Release/Tag on GitHub
This pull request is autogenerated using GitHub Actions.
For more information checkout the action '.github/workflows/create_release_pull_request.yaml'
labels: automated, new-release
branch: release/v${{ github.event.inputs.versionCode }}
delete-branch: true
reviewers: dmetzner
base: develop
- name: Check outputs
run: |
echo "Pull Request Number - ${{ env.PULL_REQUEST_NUMBER }}"
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"