-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #180 from nutdotnet/81-release-building
ClickOnce Build Workflow
- Loading branch information
Showing
11 changed files
with
323 additions
and
87 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: build-debug | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: dev-* | ||
paths: | ||
- '**.vb' | ||
- '**.vbproj' | ||
|
||
jobs: | ||
build-debug: | ||
runs-on: windows-latest | ||
steps: | ||
- name: "Get Short SHA" | ||
run: echo "SHORT_SHA=$("${{ github.sha }}".SubString(0, 8))" >> $env:GITHUB_ENV | ||
|
||
- name: Setup MSBuild | ||
uses: microsoft/setup-msbuild@v2 | ||
|
||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
# msbuild cannot handle .vdproj Installer projects, so only build debug for now. | ||
- name: Build solution | ||
run: msbuild -t:build -restore -p:Configuration=Debug WinNUT_V2/WinNUT_V2.sln | ||
|
||
- name: Upload Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ format('WinNUT-Client-debugbuild-{0}', env.SHORT_SHA) }} | ||
if-no-files-found: error | ||
path: WinNUT_V2/WinNUT-Client/bin/Debug |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,99 @@ | ||
# 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 github-actions@github.com | ||
- 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-ClickOnce-Installer.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-ClickOnce-Installer.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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: build-translation | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
pull_request: | ||
branches: Dev-2.2 | ||
paths: | ||
- "**.xlf" | ||
|
||
jobs: | ||
build-translation: | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
- name: Install Multilingual App Toolkit extension | ||
uses: microcompiler/install-vsix@db1f973c3d24d1ddc0c38f14d0e1e3a85b2ccb21 | ||
with: | ||
packagename: 'dts-publisher.mat2022' | ||
- name: Build solution in Debug configuration | ||
uses: ./.github/actions/build-solution | ||
with: | ||
build-mode: "Debug" | ||
version: "${{ vars.PRERELEASE_VERSION }}.*" |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Verify valid semver, and provide it along with an AssemblyVersion-compatible string as env vars. | ||
|
||
# Set to the value provided by github.ref | ||
param([string]$ghRef) | ||
|
||
$semVerRegex = "(?<major>0|[1-9]\d*)\.(?<minor>0|[1-9]\d*)\.(?<patch>0|[1-9]\d*)(?:-(?<prerelease>(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+(?<buildmetadata>[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$" | ||
$matchInfo = [regex]::Match($ghRef, $semVerRegex) | ||
|
||
if (!($matchInfo.Success)) { | ||
Write-Host "Could not find valid semver within ref. string. Given: $ghRef" | ||
Exit 1 | ||
} | ||
|
||
$verRes = "VER={0}.{1}.{2}" -f $matchInfo.Groups["major"], $matchInfo.Groups["minor"], $matchInfo.Groups["patch"] | ||
$semVerRes = "SEMVER=" + $matchInfo.Value | ||
$isPr = "ISPRERELEASE=" + $matchInfo.Groups.ContainsKey("prerelease").ToString().ToLower() | ||
|
||
echo $verRes >> $env:GITHUB_OUTPUT | ||
echo $semVerRes >> $env:GITHUB_OUTPUT | ||
echo $isPr >> $env:GITHUB_OUTPUT | ||
|
||
Write-Host "Result: $verRes, $semVerRes, $isPr" |
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
File renamed without changes.
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
Oops, something went wrong.