Skip to content

Commit 5e2a8a6

Browse files
authored
Merge pull request #41 from Erol444/fix-pre-release-workflow
fix pre-release workflow
2 parents 4b94115 + d941fa9 commit 5e2a8a6

File tree

1 file changed

+22
-19
lines changed

1 file changed

+22
-19
lines changed

.github/workflows/pre-release.yml

Lines changed: 22 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
name: CI-develop
1+
name: PreRelease
22

33
on:
4-
push:
5-
branches: [ develop ]
4+
pull_request:
5+
types: [closed]
66
workflow_dispatch:
7-
7+
88
jobs:
99
version:
10+
if: github.event.pull_request.merged == true
1011
runs-on: ubuntu-latest
1112
outputs:
1213
version: ${{ steps.semvers.outputs.patch }}
14+
changelog: ${{ steps.Changelog.outputs.changelog }}
1315
steps:
1416
- uses: actions/checkout@v2
1517

16-
- run: git fetch --prune --unshallow --tags
18+
- run: git fetch --prune --unshallow --tags
1719

1820
- uses: docker://agilepathway/pull-request-label-checker:latest
1921
with:
2022
one_of: pre-release
21-
repo_token: ${{ secrets.GITHUB_TOKEN }}
23+
repo_token: ${{ secrets.GITHUB_TOKEN }}
2224

2325
- name: 'Get Previous tag'
2426
id: previoustag
@@ -28,7 +30,8 @@ jobs:
2830
id: semvers
2931
uses: "WyriHaximus/github-action-next-semvers@v1"
3032
with:
31-
version: ${{ steps.previoustag.outputs.tag }}
33+
version: ${{ steps.previoustag.outputs.tag }}
34+
3235
- name: 'Create changelog'
3336
id: Changelog
3437
run: |
@@ -38,7 +41,8 @@ jobs:
3841
changelog="${changelog//$'\n'/'%0A'}"
3942
changelog="${changelog//$'\r'/'%0D'}"
4043
echo "$changelog"
41-
echo "::set-output name=changelog::$changelog"
44+
echo "::set-output name=changelog::$changelog"
45+
4246
build:
4347
runs-on: windows-latest
4448
needs: version
@@ -53,7 +57,7 @@ jobs:
5357

5458
- name: Navigate to Workspace
5559
run: cd $GITHUB_WORKSPACE
56-
60+
5761
- name: Get cache
5862
uses: actions/cache@v2
5963
with:
@@ -65,11 +69,12 @@ jobs:
6569
key: ${{ runner.os }}-nuget-${{ hashFiles('TbsCore/packages.lock.json') }}
6670
restore-keys: |
6771
${{ runner.os }}-nuget-
72+
6873
- name: Restore Packages
6974
run: |
7075
nuget restore TbsCore/TbsCore.csproj -PackagesDirectory packages
7176
nuget restore TravBotSharp/TbsWinForms.csproj -PackagesDirectory packages
72-
77+
7378
- name: Build Bot
7479
run: |
7580
msbuild.exe TravBotSharp.sln /t:TbsWinForms /nologo /nr:false /p:DeleteExistingFiles=True /p:platform="Any CPU" /p:configuration="Release" /m /p:BuildProjectReferences=true /p:BUILD_NUMBER=${{needs.version.outputs.version}}.0
@@ -80,6 +85,7 @@ jobs:
8085
name: TBS-prerelease
8186
path: TravBotSharp\bin\Release
8287
if-no-files-found: error
88+
8389
prerelease:
8490
runs-on: ubuntu-latest
8591
needs: [build, version]
@@ -96,7 +102,7 @@ jobs:
96102
with:
97103
files: TravBotSharp/bin/Release
98104
dest: TBS-${{needs.version.outputs.version}}.zip
99-
105+
100106
- name: Create pre release
101107
uses: ncipollo/release-action@v1
102108
with:
@@ -107,8 +113,9 @@ jobs:
107113
body: |
108114
**Changelog**:
109115
${{needs.version.outputs.changelog}}
116+
110117
artifacts: TBS-${{needs.version.outputs.version}}.zip
111-
token: ${{ secrets.GITHUB_TOKEN }}
118+
token: ${{ secrets.GITHUB_TOKEN }}
112119
Discord:
113120
runs-on: ubuntu-latest
114121
needs: [prerelease, version]
@@ -117,15 +124,14 @@ jobs:
117124
uses: sarisia/actions-status-discord@v1
118125
with:
119126
webhook: ${{ secrets.DISCORD_PRE_BOT }}
120-
nodetail: true
121127
title: New pre-release
128+
nodetail: true
122129
description: |
123-
**Version**: `TBS-${{needs.version.outputs.version}}`
130+
Version `TBS-${{needs.version.outputs.version}}`
124131
Click [here](https://github.com/Erol444/TravianBotSharp/releases/tag/${{needs.version.outputs.version}}) to download!
132+
125133
**Changelog**:
126134
${{needs.version.outputs.changelog}}
127-
128-
129135
Clear:
130136
runs-on: ubuntu-latest
131137
needs: prerelease
@@ -134,6 +140,3 @@ jobs:
134140
uses: geekyeggo/delete-artifact@v1
135141
with:
136142
name: TBS-prerelease
137-
138-
139-

0 commit comments

Comments
 (0)