Skip to content

Commit 225d801

Browse files
authored
Update release.yml
1 parent 1ad6317 commit 225d801

File tree

1 file changed

+49
-8
lines changed

1 file changed

+49
-8
lines changed

.github/workflows/release.yml

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,48 @@
11
name: ReleaseFlow
22

33
on:
4-
workflow_dispatch:
5-
inputs:
6-
version:
7-
required: true
8-
4+
pull_request:
5+
branches: [master]
6+
types: [closed]
97
jobs:
8+
version:
9+
if: github.event.pull_request.merged == true
10+
runs-on: ubuntu-latest
11+
outputs:
12+
version: ${{ steps.semvers.outputs.minor }}
13+
changelog: ${{ steps.Changelog.outputs.changelog }}
14+
steps:
15+
- uses: docker://agilepathway/pull-request-label-checker:latest
16+
with:
17+
one_of: release
18+
repo_token: ${{ secrets.GITHUB_TOKEN }}
19+
20+
- name: 'Checkout repo'
21+
uses: actions/checkout@v2
22+
23+
- name: 'Update tag'
24+
run: git fetch --prune --unshallow --tags
25+
26+
- name: 'Get latest tag'
27+
id: latesttag
28+
uses: pozetroninc/github-action-get-latest-release@master
29+
with:
30+
repository: ${{ github.repository }}
31+
32+
- name: 'Get next version'
33+
id: semvers
34+
uses: "WyriHaximus/github-action-next-semvers@v1"
35+
with:
36+
version: ${{ steps.latesttag.outputs.release }}
37+
38+
- name: 'Create changelog'
39+
id: Changelog
40+
run: |
41+
changelog="${{github.event.pull_request.body}}"
42+
changelog="${changelog//'%'/'%25'}"
43+
changelog="${changelog//$'\n'/'%0A'}"
44+
changelog="${changelog//$'\r'/'%0D'}"
45+
echo "::set-output name=changelog::$changelog"
1046
build:
1147
runs-on: windows-2019
1248
strategy:
@@ -36,7 +72,7 @@ jobs:
3672

3773
release:
3874
runs-on: ubuntu-latest
39-
needs: build
75+
needs: [build, version]
4076
steps:
4177
- name: Download artifact
4278
uses: actions/download-artifact@v3
@@ -59,7 +95,9 @@ jobs:
5995
token: ${{ secrets.GITHUB_TOKEN }}
6096
body: |
6197
Please join our Discord server for more information: [https://discord.gg/mBa4f2K](https://discord.gg/mBa4f2K)
62-
98+
99+
**Changelog**:
100+
${{needs.version.outputs.changelog}}
63101
Discord:
64102
runs-on: ubuntu-latest
65103
needs: release
@@ -75,7 +113,10 @@ jobs:
75113
nodetail: true
76114
description: |
77115
Version `TBS-${{github.event.inputs.version}}`
78-
Click [here](https://github.com/Erol444/TravianBotSharp/releases/tag/${{github.event.inputs.version}}) to download!
116+
Click [here](https://github.com/Erol444/TravianBotSharp/releases/tag/${{needs.version.outputs.version}}) to download!
117+
118+
**Changelog**:
119+
${{needs.version.outputs.changelog}}
79120
Clear:
80121
runs-on: ubuntu-latest
81122
needs: release

0 commit comments

Comments
 (0)