forked from Catrobat/Catroweb
-
Notifications
You must be signed in to change notification settings - Fork 0
106 lines (89 loc) · 3.8 KB
/
create_release_pull_request.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
103
104
105
106
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# ** 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@v3
# 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@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Prepare release v${{ github.event.inputs.versionCode }}
committer: Catrobot <Catrobot@catroweb.github.com>
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@v3
- 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@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Prepare release v${{ github.event.inputs.versionCode }}
committer: Catrobot <Catrobot@catroweb.github.com>
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 }}"