release #22
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: CI | |
on: | |
push: | |
branches: ["main"] | |
tags: ["*"] | |
pull_request: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
arch: [x86, x64, arm, arm64] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup MSBuild.exe | |
uses: microsoft/setup-msbuild@v1 | |
- name: Restore the application | |
run: | | |
nuget restore | |
- name: Generate string files | |
run: | | |
$NugetPackage = nuget locals global-packages -list | |
$NugetPackage = $NugetPackage.SubString(17) | |
$ToolVersions = (Get-ChildItem (Join-Path $NugetPackage 'Opportunity.ResourceGenerator') | Sort-Object Name -Descending)[0] | |
$ToolPath = Join-Path $ToolVersions.FullName '/tools/Opportunity.ResourceGenerator.Generator.exe' | |
&$ToolPath "./ExViewer.sln" | |
- name: Generate env files | |
run: | | |
@" | |
namespace ExViewer { class Github { | |
public const string BRANCH = "${{ github.ref_name }}"; | |
public const string COMMIT = "${{ github.sha }}"; | |
} } | |
"@ > ./ExViewer/Github.cs | |
Get-Content ./ExViewer/Github.cs | |
- name: Prepare certificate | |
run: | | |
$certKey = "${{ secrets.CERT_PASS }}" | |
if ($certKey) { | |
$certFile = Get-Item "./ExViewer/ExViewer_TemporaryKey.pfx" | |
$certPass = ConvertTo-SecureString -AsPlainText $certKey -Force | |
Write-Output "Using exist certificate" | |
Import-PfxCertificate $certFile -Password $certPass -CertStoreLocation Cert:\CurrentUser\My\ | |
} else { | |
$cert = New-SelfSignedCertificate -Type CodeSigningCert -Subject "CN=Opportunity" -CertStoreLocation Cert:\CurrentUser\My\ | |
((Get-Content -Raw "./ExViewer/ExViewer.csproj") -replace 'AC82A857467374ACB64C3F8A542446485164DD50',$cert.Thumbprint) | Set-Content "./ExViewer/ExViewer.csproj" | |
Write-Output "Using new certificate" | |
Write-Output $cert | |
} | |
- name: Build the application | |
run: msbuild ExViewer.sln /p:Configuration=Release /p:Platform=${{ matrix.arch }} | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Packages | |
path: ExViewer/AppPackages | |
deploy: | |
needs: build | |
if: startsWith(github.event.ref, 'refs/tags/') | |
runs-on: windows-latest | |
steps: | |
- name: Download build artifacts | |
uses: actions/[email protected] | |
with: | |
name: Packages | |
path: ./ | |
- name: Upload symbols | |
env: | |
MOBILE_CENTER_CURRENT_APP: Opportunity/E-Viewer | |
APPCENTER_ACCESS_TOKEN: ${{ secrets.APPCENTER_ACCESS_TOKEN }} | |
run: | | |
yarn global add appcenter-cli | |
$env:Path = "$env:Path;$(yarn global bin)" | |
Get-ChildItem **/*.appxsym | ForEach-Object { | |
Write-Output "Uploading $($_.Name)" | |
appcenter crashes upload-symbols --disable-telemetry --appxsym "$_" | |
} | |
- name: Publish to github release | |
uses: ncipollo/release-action@v1 | |
with: | |
draft: true | |
omitDraftDuringUpdate: true | |
allowUpdates: true | |
artifacts: "*/*.msix,*/*.cer,*/*.appxsym" | |
replacesArtifacts: true |