Skip to content

Merge pull request #194 from LanceMcCarthy/dependabot/nuget/src/Media… #197

Merge pull request #194 from LanceMcCarthy/dependabot/nuget/src/Media…

Merge pull request #194 from LanceMcCarthy/dependabot/nuget/src/Media… #197

Workflow file for this run

# If you are looking for guidance for your builds, see https://github.com/microsoft/github-actions-for-desktop-apps
name: Main
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "src/**/*"
- ".github/workflows/ci_main.yml"
jobs:
build:
runs-on: windows-2022
env:
NugetConfigPath: src\nuget.config
Configuration: Release
WappProjectPath: src\MediaFileManager\PackageProject\PackageProject.wapproj
CommonProjectPath: src\MediaFileManager\MediaFileManager.Common\MediaFileManager.Common.csproj
WpfProjectPath: src\MediaFileManager\MediaFileManager.Desktop\MediaFileManager.Desktop.csproj
SolutionPath: src\MediaFileManager\MediaFileManager.sln
TFM: net7.0-windows10.0.19041.0
TargetPlatform: "x64"
AppxBuildMode: CI
AppxBundlePlatforms: "x86|x64|arm64"
AppxBundleMode: Never
AppxPackageSigningEnabled: False
GenerateAppInstallerFile: False
TELERIK_NUGET_KEY: ${{ secrets.TELERIK_NUGET_KEY }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Generate version number with date and workflow Run Number
id: version-creator
run: |
$buildDay = Get-Date -Format "yyyy.Mdd"
$runNumber = "$env:GITHUB_RUN_NUMBER"
$ver = $buildDay + "." + $runNumber + ".0"
echo "::set-output name=APP_VERSION::$ver"
- name: Update manifest version
run: |
[xml]$manifest = get-content "src\MediaFileManager\PackageProject\Package.appxmanifest"
$manifest.Package.Identity.Version = "${{ steps.version-creator.outputs.APP_VERSION }}"
$manifest.save("src\MediaFileManager\PackageProject\Package.appxmanifest")
- name: Update WPF Assembly version
run: |
function SetAssemblyFileVersion([string]$pathToFile, [string]$newVersion) {
$newFile = Get-Content $pathToFile -encoding "UTF8" | foreach-object {
if ($_.StartsWith("[assembly: AssemblyFileVersion")) {
$verStart = $_.IndexOf("(")
$verEnd = $_.IndexOf(")", $verStart)
$origVersion = $_.SubString($verStart+2, $verEnd-$verStart-3)
$newVersion = "${{ steps.version-creator.outputs.APP_VERSION }}"
write-host "Setting AssemblyFileVersion from $origVersion to $newVersion"
$_.Replace($origVersion, $newVersion)
} else {
$_
}
}
$newfile | Set-Content $assemblyInfoPath -encoding "UTF8"
}
$assemblyInfoPath = "src\MediaFileManager\MediaFileManager.Desktop\Properties\AssemblyInfo.cs"
SetAssemblyFileVersion $assemblyInfoPath "${{ steps.version-creator.outputs.APP_VERSION }}"
- name: Install .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.0'
- name: Setup MSBuild.exe
uses: microsoft/[email protected]
with:
msbuild-architecture: x64
# Use dotnet restore command for the solution (see RIDs https://docs.microsoft.com/en-us/dotnet/core/rid-catalog)
- name: DotNet Restore
run: dotnet restore ${{ env.WappProjectPath }} --configfile ${{ env.NugetConfigPath }} --runtime ${{ env.TFM }}
# Build the WAP project. BuildMode is set to CI so we do not have to generate actual packages.
- name: Build the Windows Application Packaging Project (wapproj)
run: msbuild ${{ env.WappProjectPath }} /t:Restore /p:Configuration=${{ env.Configuration }} /p:Platform=${{ env.TargetPlatform }} /p:UapAppxPackageBuildMode=${{ env.AppxBuildMode }} /p:AppxBundle=${{ env.AppxBundleMode }} /p:AppxPackageSigningEnabled=${{ env.AppxPackageSigningEnabled }} /p:GenerateAppInstallerFile=${{ env.GenerateAppInstallerFile }} /p:AppxBundlePlatforms="${{ env.AppxBundlePlatforms }}"