Remove action, release build tweaks #25
Workflow file for this run
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
# Build solution in Release mode and submit a GitHub release. | |
name: build-release | |
on: | |
push: | |
tags: "v*" | |
env: | |
# The desired name of the no-install archive to be uploaded along side the installer. | |
ARCHIVE_NAME: "_winnut-client-noinstall" | |
jobs: | |
build-release: | |
runs-on: windows-latest | |
steps: | |
- name: Setup Git | |
run: | | |
git config --global url."https://user:${{ secrets.GITHUB_TOKEN }}@github".insteadOf https://github | |
git config --global user.name github-actions | |
git config --global user.email [email protected] | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Extract version from tag | |
id: get-ver | |
run: ./.github/workflows/get-ver.ps1 ${{ github.ref }} | |
- name: Confirm Build mode | |
id: build-mode | |
run: > | |
if ($${{ steps.get-ver.outputs.ISPRERELEASE }}) | |
{ echo "BUILD_MODE=PreRelease" >> $env:GITHUB_OUTPUT } | |
else { echo "BUILD_MODE=Release" >> $env:GITHUB_OUTPUT } | |
- name: Setup MSBuild | |
uses: microsoft/setup-msbuild@v2 | |
- name: Build solution | |
working-directory: WinNUT_V2 | |
run: > | |
msbuild -t:"publish" -restore | |
-p:Configuration="${{ steps.build-mode.outputs.BUILD_MODE }}" | |
-p:Version="${{ steps.get-ver.outputs.VER }}" | |
-p:ApplicationVersion="${{ steps.get-ver.outputs.VER }}.0" | |
-p:PublishDir="./publish" | |
- name: Checkout pages branch | |
uses: actions/checkout@v4 | |
with: | |
ref: "gh-pages" | |
path: "gh-pages" | |
- name: Prep ClickOnce branch and deploy | |
working-directory: gh-pages | |
run: | | |
$outDir = "WinNUT_V2/WinNUT-Client/publish" | |
Write-Output "Removing previous files..." | |
if (Test-Path "Application Files") { | |
Remove-Item -Path "Application Files" -Recurse | |
} | |
if (Test-Path "WinNUT-Client.application") { | |
Remove-Item -Path "WinNUT-Client.application" | |
} | |
Write-Output "Copying new files..." | |
Copy-Item -Path "../$outDir/Application Files","../$outDir/WinNUT-Client.application" -Destination . -Recurse | |
# Stage and commit. | |
Write-Output "Staging..." | |
git add -A | |
Write-Output "Committing..." | |
git commit -m "Update to ${{ env.SEMVER }}" | |
# Push. | |
git push | |
- name: Prepare no install archive | |
run: | | |
$arc = Compress-Archive -PassThru -Path "WinNUT_V2\WinNUT-Client\bin\${{ steps.build-mode.outputs.BUILD_MODE }}" -DestinationPath "${{ env.ARCHIVE_NAME }}-${{ steps.get-ver.outputs.SEMVER }}.zip" | |
$arc = $arc -replace '\\','/' | |
echo "ARCHIVE_NAME=$arc" >> $env:GITHUB_ENV | |
# Rename the CO bootstrapper file to appear after the MSI once it's uploaded. | |
- name: HACK - Rename ClickOnce bootstrapper | |
run: Rename-Item -Path "./WinNUT_V2/WinNUT-Client/publish/WinNUT-Client.application" -NewName "_WinNUT-Client.application" | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v2 | |
with: | |
draft: true | |
fail_on_unmatched_files: true | |
generate_release_notes: true | |
files: | | |
WinNUT_V2/WinNUT-Client/publish/_WinNUT-Client.application | |
${{ env.ARCHIVE_NAME }} | |
# Leave out other files until we no longer need the MSI be first in the assets list. | |
# LICENSE.txt | |
# README.md | |
# CHANGELOG.md |