Skip to content

build: release

build: release #12

Workflow file for this run

name: CI
on:
push:
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/download-artifact@v3
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