Skip to content

.github/workflows/build_release.yaml #83

.github/workflows/build_release.yaml

.github/workflows/build_release.yaml #83

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