-
Notifications
You must be signed in to change notification settings - Fork 5
158 lines (131 loc) · 5.74 KB
/
trigger_release.yml
File metadata and controls
158 lines (131 loc) · 5.74 KB
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: Create new release branch
on:
workflow_dispatch:
inputs:
versionPrefix:
description: 'Version number (ie 1.0.0)'
required: true
versionSuffix:
description: 'Version suffix (ie alef)'
required: true
env:
DOTNET_VERSION: 'v6.0.301' # The .NET SDK version to use
jobs:
build:
name: build-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core
uses: actions/setup-dotnet@v2.1.0
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies
run: dotnet restore ./src/
- name: Build
run: dotnet build ./src/ --no-restore
create-release-branch:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: develop
- name: Create release branch
run: git checkout -b release/v${{ github.event.inputs.versionPrefix }}
- name: Setup git config
run: |
git config user.name "GitHub Actions"
git config user.email noreply@github.com
- name: Change version number and name of project
shell: pwsh
run: |
./util/set_version.ps1 engine "${{ github.event.inputs.versionPrefix }}" "${{ github.event.inputs.versionSuffix }}"
- name: Commit version change
run: |
git add .
git commit -m "Prepare release ${{ github.event.inputs.versionPrefix }}-${{ github.event.inputs.versionSuffix }}"
echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Push changes
run: git push origin release/v${{ github.event.inputs.versionPrefix }}
create-pull-requests:
needs: create-release-branch
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: release/v${{ github.event.inputs.versionPrefix }}
- name: Setup git config
run: |
git config user.name "GitHub Actions"
git config user.email noreply@github.com
- name: Build changelog
id: build-changelog
uses: heinrichreimer/github-changelog-generator-action@v2.3
with:
token: ${{ secrets.GITHUB_TOKEN }}
output: "./CHANGELOG.md"
excludeLabels: changelog-ignore
- name: Commit changelog
run: |
git add .
git commit --message "Added changelog for release"
echo "::set-output name=commit::$(git rev-parse HEAD)"
- name: Push changelog
run: git push
- name: Create pull request into develop
uses: repo-sync/pull-request@v2
with:
source_branch: "release/v${{ github.event.inputs.versionPrefix }}"
destination_branch: "develop"
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "New release to develop pending 🤖 ${{ github.event.inputs.versionPrefix }} ${{ github.event.inputs.versionSuffix }}"
pr_body: "PR created by the creation of a new release branch. Merge in when you can get around to it. Changes contained here-in should mostly just be the changelog."
pr_label: "changelog-ignore"
- name: Create pull request into main
uses: repo-sync/pull-request@v2
with:
source_branch: "release/v${{ github.event.inputs.versionPrefix }}"
destination_branch: "main"
github_token: ${{ secrets.GITHUB_TOKEN }}
pr_title: "New release to main pending 🤖 ${{ github.event.inputs.versionPrefix }} ${{ github.event.inputs.versionSuffix }}"
pr_body: "PR created by the creation of a new release branch. Merge in when this release is considered stable enough for main."
pr_label: "changelog-ignore"
#- name: Create Pull Request into develop
#uses: peter-evans/create-pull-request@v4
#with:
#commit-message: A new release has been made to develop
#title: "New release to develop pending 🤖 ${{ github.event.inputs.versionPrefix }} ${{ github.event.inputs.versionSuffix }}"
#body: "PR created by the creation of a new release branch. Merge in when you can get around to it. Changes contained here-in should mostly just be the changelog."
#branch: release/v${{ github.event.inputs.versionPrefix }}
#base: develop
#labels: changelog-ignore
#- name: Create Pull Request into main
#uses: peter-evans/create-pull-request@v4
#with:
#commit-message: A new release has been made to main
#title: "New release to main pending 🤖 ${{ github.event.inputs.versionPrefix }} ${{ github.event.inputs.versionSuffix }}"
#body: "PR created by the creation of a new release branch. Merge in when this release is considered stable enough for main."
#branch: release/v${{ github.event.inputs.versionPrefix }}
#base: main
#labels: changelog-ignore
create-release:
needs: create-release-branch
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
ref: release/v${{ github.event.inputs.versionPrefix }}
- name: Create release
uses: ncipollo/release-action@v1
with:
tag: "v${{ github.event.inputs.versionPrefix }}-${{ github.event.inputs.versionSuffix }}.pre"
commit: "release/v${{ github.event.inputs.versionPrefix }}"
bodyFile: "./CHANGELOG.md"
token: ${{ secrets.GITHUB_TOKEN }}