Update push_master.yml #9
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
name: Build and publish application on master push | |
on: | |
push: | |
branches: | |
- "master" | |
- "features/github_actions" | |
#paths: | |
#- "VDownload**" | |
jobs: | |
build: | |
name: Build | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
configuration: [Release] | |
platform: [x64, ARM64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Setup GitVersion | |
uses: gittools/actions/gitversion/setup@v0.9.7 | |
with: | |
versionSpec: 5.x | |
- name: Determine Version | |
uses: gittools/actions/gitversion/execute@v0.9.7 | |
id: gitversion | |
with: | |
useConfigFile: true | |
configFilePath: .github/config/gitversion.yml | |
- name: Set version in VDownload.csproj file | |
id: package_version | |
uses: KageKirin/set-csproj-version@v0 | |
with: | |
file: VDownload/VDownload.csproj | |
version: ${{steps.gitversion.outputs.SemVer}} | |
- name: Set version in Package.appxmanifest file | |
uses: Nambers/ReplaceStringInFile@v1.3 | |
with: | |
path: VDownload/Package.appxmanifest | |
oldString: 0\.0\.0\.0 | |
newString: ${{steps.gitversion.outputs.SemVer}}.0 | |
showFileContent: true | |
escapeBackslash: true | |
- name: Set version in app.manifest file | |
uses: Nambers/ReplaceStringInFile@v1.3 | |
with: | |
path: VDownload/app.manifest | |
oldString: "assemblyIdentity version=\"0.0.0.0\"" | |
newString: "assemblyIdentity version=\"${{steps.gitversion.outputs.SemVer}}.0\"" | |
showFileContent: true | |
escapeBackslash: true | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 8.0.x | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: Restore the application | |
run: msbuild VDownload /t:Restore /p:Configuration=$env:Configuration | |
env: | |
Configuration: ${{ matrix.configuration }} | |
- name: Decode certificate | |
run: | | |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}") | |
$certificatePath = "Certificate.pfx" | |
[IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | |
- name: Create the app package | |
run: msbuild VDownload /p:Configuration=$env:Configuration /p:Platform=$env:Platform /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=Certificate.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GenerateAppxPackageOnBuild=true | |
env: | |
Appx_Bundle: Never | |
Appx_Package_Build_Mode: SideloadOnly | |
Appx_Package_Dir: Packages\ | |
Configuration: ${{ matrix.configuration }} | |
Platform: ${{ matrix.platform }} | |
- name: Remove certificate | |
run: Remove-Item -path Certificate.pfx | |
- name: Upload package as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: MSIX Package | |
path: VDownload\\Packages |