Merge pull request #96 from gwdevhub/dev #29
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Release | |
on: | |
push: | |
branches: [ "master" ] | |
pull_request: | |
branches: [ "master" ] | |
defaults: | |
run: | |
shell: pwsh | |
jobs: | |
build: | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: .NET Tool Restore | |
run: dotnet tool restore | |
- name: GitVersion | |
run: | | |
$gitVersionOutput = dotnet dotnet-gitversion /output json | |
$gitVersionObj = $gitVersionOutput | ConvertFrom-Json | |
$version = "$($gitVersionObj.Major).$($gitVersionObj.Minor)" | |
echo "VERSION=$version" >> $env:GITHUB_ENV | |
- name: Build GW Launcher Self Contained | |
run: | | |
MSBuild.exe "GW Launcher\GW Launcher.csproj" ` | |
/target:"Restore;Publish" ` | |
/m /nodeReuse:false ` | |
/property:"PublishProfile=SelfContained" ` | |
/property:GitVersion_NoFetchEnabled=true | |
- name: Rename SelfContained Executable | |
run: | | |
Move-Item -Path "Publish\GW Launcher.exe" -Destination "Publish\GW_Launcher.exe" -Force | |
- name: Build GW Launcher Framework Dependent | |
run: | | |
MSBuild.exe "GW Launcher\GW Launcher.csproj" ` | |
/target:"Restore;Publish" ` | |
/m /nodeReuse:false ` | |
/property:"PublishProfile=FrameworkDependent" ` | |
/property:GitVersion_NoFetchEnabled=true | |
- name: Rename FrameworkDependent Executable | |
run: | | |
Move-Item -Path "Publish\GW Launcher.exe" -Destination "Publish\GW_Launcher_Framework_Dependent.exe" -Force | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: GW Launcher | |
path: | | |
Publish\GW_Launcher.exe | |
Publish\GW_Launcher_Framework_Dependent.exe | |
if-no-files-found: error | |
- name: Create Release | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create "r${{ env.VERSION }}" ` | |
--title "Release ${{ env.VERSION }}" ` | |
--notes "Release ${{ env.VERSION }}" ` | |
./Publish/GW_Launcher.exe ` | |
./Publish/GW_Launcher_Framework_Dependent.exe |