forked from Heroes-Profile/HeroesProfile.Uploader
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
208 additions
and
13 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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Build | ||
name: Build (dagger) | ||
on: | ||
push: | ||
branches: | ||
|
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
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,30 @@ | ||
name: ClickOnce Release v2 | ||
permissions: | ||
contents: write | ||
packages: write | ||
pages: write | ||
|
||
on: | ||
push: | ||
tags: [v*] | ||
|
||
jobs: | ||
release: | ||
runs-on: windows-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: 'true' | ||
fetch-depth: 0 | ||
|
||
- 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: Run release script | ||
shell: pwsh | ||
run: ./release.ps1 |
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
41 changes: 41 additions & 0 deletions
41
Heroesprofile.Uploader.Windows/Properties/PublishProfiles/CLickOnceProfile.pubxml
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,41 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
https://go.microsoft.com/fwlink/?LinkID=208121. | ||
--> | ||
<Project> | ||
<PropertyGroup> | ||
<ApplicationRevision>0</ApplicationRevision> | ||
<ApplicationVersion>0.2.0.0</ApplicationVersion> | ||
<BootstrapperEnabled>True</BootstrapperEnabled> | ||
<Configuration>Release</Configuration> | ||
<CreateWebPageOnPublish>True</CreateWebPageOnPublish> | ||
<GenerateManifests>true</GenerateManifests> | ||
<Install>True</Install> | ||
<InstallFrom>Web</InstallFrom> | ||
<InstallUrl>https://heroesreplay.github.io/HeroesProfile.Uploader/</InstallUrl> | ||
<IsRevisionIncremented>False</IsRevisionIncremented> | ||
<IsWebBootstrapper>True</IsWebBootstrapper> | ||
<MapFileExtensions>True</MapFileExtensions> | ||
<OpenBrowserOnPublish>False</OpenBrowserOnPublish> | ||
<Platform>Any CPU</Platform> | ||
<PublishDir>bin\publish\</PublishDir> | ||
<PublishUrl>bin\publish\</PublishUrl> | ||
<PublishProtocol>ClickOnce</PublishProtocol> | ||
<PublishReadyToRun>False</PublishReadyToRun> | ||
<PublishSingleFile>False</PublishSingleFile> | ||
<SelfContained>True</SelfContained> | ||
<SignatureAlgorithm>(none)</SignatureAlgorithm> | ||
<SignManifests>False</SignManifests> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<UpdateEnabled>True</UpdateEnabled> | ||
<UpdateMode>Foreground</UpdateMode> | ||
<UpdateRequired>False</UpdateRequired> | ||
<WebPageFileName>Publish.html</WebPageFileName> | ||
</PropertyGroup> | ||
<!-- <ItemGroup> | ||
<BootstrapperPackage Include="Microsoft.NetCore.DesktopRuntime.6.0.x64"> | ||
<Install>True</Install> | ||
<ProductName>.NET Desktop Runtime 6.0.10 (x64)</ProductName> | ||
</BootstrapperPackage> | ||
</ItemGroup> --> | ||
</Project> |
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,101 @@ | ||
# Copied from https://janjones.me/posts/clickonce-installer-build-publish-github/. | ||
|
||
[CmdletBinding(PositionalBinding = $false)] | ||
param ( | ||
[switch]$OnlyBuild = $false | ||
) | ||
|
||
$appName = "Heroesprofile.Uploader" | ||
$projDir = "Heroesprofile.Uploader.Windows" | ||
|
||
Set-StrictMode -version 2.0 | ||
$ErrorActionPreference = "Stop" | ||
|
||
Write-Output "Working directory: $pwd" | ||
|
||
# Find MSBuild. | ||
$msBuildPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" ` | ||
-latest -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe ` | ||
-prerelease | select-object -first 1 | ||
Write-Output "MSBuild: $((Get-Command $msBuildPath).Path)" | ||
|
||
# Load current Git tag. | ||
$tag = $(git describe --tags) | ||
Write-Output "Tag: $tag" | ||
|
||
# Parse tag into a three-number version. | ||
$version = $tag.Split('-')[0].TrimStart('v') | ||
$version = "$version.0" | ||
Write-Output "Version: $version" | ||
|
||
# Clean output directory. | ||
$publishDir = "bin/publish" | ||
$outDir = "$projDir/$publishDir" | ||
if (Test-Path $outDir) { | ||
Remove-Item -Path $outDir -Recurse | ||
} | ||
|
||
# Publish the application. | ||
Push-Location $projDir | ||
try { | ||
Write-Output "Restoring:" | ||
dotnet restore -r win-x64 | ||
Write-Output "Publishing:" | ||
$msBuildVerbosityArg = "/v:m" | ||
if ($env:CI) { | ||
$msBuildVerbosityArg = "" | ||
} | ||
& $msBuildPath /target:publish /p:PublishProfile=ClickOnceProfile ` | ||
/p:ApplicationVersion=$version /p:Configuration=Release ` | ||
/p:PublishDir=$publishDir /p:PublishUrl=$publishDir ` | ||
$msBuildVerbosityArg | ||
|
||
# Measure publish size. | ||
$publishSize = (Get-ChildItem -Path "$publishDir/Application Files" -Recurse | | ||
Measure-Object -Property Length -Sum).Sum / 1Mb | ||
Write-Output ("Published size: {0:N2} MB" -f $publishSize) | ||
} | ||
finally { | ||
Pop-Location | ||
} | ||
|
||
if ($OnlyBuild) { | ||
Write-Output "Build finished." | ||
exit | ||
} | ||
|
||
# Clone `gh-pages` branch. | ||
$ghPagesDir = "gh-pages" | ||
if (-Not (Test-Path $ghPagesDir)) { | ||
git clone $(git config --get remote.origin.url) -b gh-pages ` | ||
--depth 1 --single-branch $ghPagesDir | ||
} | ||
|
||
Push-Location $ghPagesDir | ||
try { | ||
# Remove previous application files. | ||
Write-Output "Removing previous files..." | ||
if (Test-Path "Application Files") { | ||
Remove-Item -Path "Application Files" -Recurse | ||
} | ||
if (Test-Path "$appName.application") { | ||
Remove-Item -Path "$appName.application" | ||
} | ||
|
||
# Copy new application files. | ||
Write-Output "Copying new files..." | ||
Copy-Item -Path "../$outDir/Application Files", "../$outDir/$appName.application" ` | ||
-Destination . -Recurse | ||
|
||
# Stage and commit. | ||
Write-Output "Staging..." | ||
git add -A | ||
Write-Output "Committing..." | ||
git commit -m "Update to v$version" | ||
|
||
# Push. | ||
git push | ||
} | ||
finally { | ||
Pop-Location | ||
} |