-
-
Notifications
You must be signed in to change notification settings - Fork 68
76 lines (74 loc) · 2.72 KB
/
build_release.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
on:
workflow_dispatch:
env:
RELEASE_NAME: SteamDeckTools
DOTNET_VERSION: '6.0.x'
jobs:
build-and-release:
runs-on: windows-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- name: Install dependencies
run: dotnet restore
- name: Set RELEASE_VERSION
shell: bash
run: |
majorVer=$(cat VERSION)
lastVer=$(git tag --sort version:refname --list "$majorVer.*" | tail -n1)
if [[ -n "$lastVer" ]]; then
newVer=(${lastVer//./ })
newVer[-1]="$((${newVer[-1]}+1))"
nextVer="${newVer[*]}"
nextVer="${nextVer// /.}"
else
nextVer="$majorVer.0"
fi
echo "MajorVer=$majorVer LastVer=$lastVer NextVer=$nextVer"
echo "RELEASE_VERSION=$nextVer" >> $GITHUB_ENV
- name: Build Release
run: dotnet build --configuration Release --output "${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}/" "/property:Version=${{ env.RELEASE_VERSION }}" "/property:ExtraDefineConstants=PRODUCTION_BUILD"
- name: Build Debug
run: dotnet build --configuration Debug --output "${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}-debug/" "/property:Version=${{ env.RELEASE_VERSION }}" "/property:ExtraDefineConstants=PRODUCTION_BUILD"
- name: Test
run: dotnet test --no-restore --verbosity normal
- uses: vimtor/action-zip@v1
with:
files: ${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}
dest: ${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}-portable.zip
recursive: true
- uses: vimtor/action-zip@v1
with:
files: ${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}-debug
dest: ${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}-debug.zip
recursive: true
- name: Install NSIS
run: choco install nsis
- name: Create release installer
uses: joncloud/makensis-action@v3.7
with:
script-file: scripts/SteamDeckTools_Setup.nsi
arguments:
/V3
/DUSE_WINGET
/DVERSION=${{ env.RELEASE_VERSION }}
/DBUILD_DIR=../${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}
/DOUTPUT_FILE=../${{ env.RELEASE_NAME }}-${{ env.RELEASE_VERSION }}-setup.exe
- name: Update version in RELEASE.md
shell: bash
run: |
sed -i 's|#{GIT_TAG_NAME}|${{ env.RELEASE_VERSION }}|g' RELEASE.md
- uses: ncipollo/release-action@v1
with:
tag: ${{ env.RELEASE_VERSION }}
artifacts: "*.zip,*-setup.exe"
prerelease: true
generateReleaseNotes: true
bodyFile: RELEASE.md