Update wpf-beta.yml #63
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: WPF Beta | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
wpf-beta: | |
runs-on: windows-latest | |
steps: | |
- name: Git - Checkout | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: GitVersion - Install | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: '5.x' | |
- name: GitVersion - Execute | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
useConfigFile: true | |
additionalArguments: '/updateprojectfiles' | |
- name: Environment - Build Number | |
uses: myci-actions/export-env-var@1 | |
with: | |
name: BUILD_NUMBER | |
value: ${{ steps.gitversion.outputs.fullSemVer }} | |
- name: Environment - Github Token | |
uses: myci-actions/export-env-var@1 | |
with: | |
name: GITHUB_TOKEN | |
value: ${{ github.token }} | |
- name: .NET - Setup | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.x | |
- name: .NET - Restore | |
run: dotnet restore | |
- name: .NET - Build | |
run: dotnet build --no-restore | |
- name: .NET - Tests | |
run: dotnet test --no-build --verbosity normal | |
- name: Build - Sidekick.Protocol | |
run: dotnet publish src/Sidekick.Protocol/Sidekick.Protocol.csproj -p:PublishProfile=Build | |
- name: Build - Sidekick.Wpf | |
shell: pwsh | |
run: | | |
$version = "${{ steps.gitversion.outputs.majorMinorPatch }}.${{ steps.gitversion.outputs.buildMetaData }}" | |
Write-Output "Version: $version" | |
# 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 | |
Push-Location "src/Sidekick.Wpf" | |
& $msBuildPath Sidekick.Wpf.csproj /target:Publish /property:PublishProfile=ClickOnceBeta /property:ApplicationVersion=$version /property:PublishDir=bin/publish | |
# & $msBuildPath /target:publish /p:PublishProfile=ClickOnceBeta /p:ApplicationVersion=$version /p:Configuration=Release /p:PublishDir=bin/publish /p:PublishUrl=bin/publish | |
Pop-Location | |
- name: Git - Setup | |
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: Git - Setup SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_BETA_KEY }} | |
- name: Git - Push to repository | |
shell: pwsh | |
run: | | |
$deployRepository = "[email protected]:Sidekick-Poe/Sidekick-Beta.git" | |
Write-Output "Deploy repository: $deployRepository" | |
# Clone `gh-pages` branch. | |
git clone $deployRepository -b gh-pages --single-branch "dist" | |
Push-Location "dist" | |
try { | |
Write-Output "Removing previous files..." | |
if (Test-Path "Application Files") { | |
Remove-Item -Path "Application Files" -Recurse | |
} | |
if (Test-Path "Sidekick.application") { | |
Remove-Item -Path "Sidekick.application" | |
} | |
Write-Output "Copying new files..." | |
Copy-Item -Path "../src/Sidekick.Wpf/bin/publish/Application Files","../src/Sidekick.Wpf/bin/publish/Sidekick.application" -Destination . -Recurse | |
# Stage and commit. | |
git add -A | |
git commit -m "Update to v$version" | |
git push | |
} finally { | |
Pop-Location | |
} |