Skip to content

Commit

Permalink
ci: add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
OpportunityLiu committed Oct 29, 2023
1 parent a1ce22a commit 42b8d19
Show file tree
Hide file tree
Showing 11 changed files with 162 additions and 135 deletions.
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file

version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"

# Maintain dependencies for nuget
- package-ecosystem: "nuget"
directory: "/"
schedule:
interval: "weekly"
64 changes: 64 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: build

on:
workflow_call:

jobs:
build:
runs-on: windows-latest

strategy:
matrix:
arch: [x64, arm64]

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v1

- name: Restore the application
run: msbuild /p:Configuration=Release /p:Platform=${{ matrix.arch }} /t: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 "./E-Viewer/E-Viewer-Key.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 "./E-Viewer/E-Viewer.csproj") -replace 'AC82A857467374ACB64C3F8A542446485164DD50',$cert.Thumbprint) | Set-Content "./E-Viewer/E-Viewer.csproj"
Write-Output "Using new certificate"
Write-Output $cert
}
- name: Build the application
run: msbuild /p:Configuration=Release /p:Platform=${{ matrix.arch }} /p:GenerateAppxPackageOnBuild=true

- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Packages
path: E-Viewer/out
15 changes: 15 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: check

on:
push:
branches: ["*"]
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit
100 changes: 0 additions & 100 deletions .github/workflows/ci.yml

This file was deleted.

39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: release

on:
push:
tags: ["*"]

jobs:
build:
uses: ./.github/workflows/build.yml
secrets: inherit

publish:
needs: build
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: |
npm install -g appcenter-cli
Get-ChildItem */*.msixsym | 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,*/*.msixsym"
replacesArtifacts: true
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# Build results
bin/
obj/
out/

# Visual Studio cache/options directory
.vs/
Expand Down
Binary file added E-Viewer/E-Viewer-Key.pfx
Binary file not shown.
24 changes: 17 additions & 7 deletions E-Viewer/E-Viewer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,23 @@
<RootNamespace>Eviewer</RootNamespace>
<ApplicationManifest>app.manifest</ApplicationManifest>
<Platforms>x64;ARM64</Platforms>
<RuntimeIdentifiers>win10-x86;win10-x64;win10-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers>win10-x64;win10-arm64</RuntimeIdentifiers>
<PublishProfile>win10-$(Platform).pubxml</PublishProfile>
<UseWinUI>true</UseWinUI>
<EnableMsixTooling>true</EnableMsixTooling>
<Nullable>enable</Nullable>
<DefaultLanguage>en</DefaultLanguage>
<EnableMsixTooling>true</EnableMsixTooling>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<PackageCertificateThumbprint>AC82A857467374ACB64C3F8A542446485164DD50</PackageCertificateThumbprint>
<AppxPackageDir>out\</AppxPackageDir>
<AppxPackageSigningEnabled>True</AppxPackageSigningEnabled>
<Nullable>enable</Nullable>
<EnforceCodeStyleInBuild>True</EnforceCodeStyleInBuild>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<AppxSymbolPackageEnabled>True</AppxSymbolPackageEnabled>
<AppxBundle>Never</AppxBundle>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
</PropertyGroup>
<ItemGroup>
<None Remove="Strings\en\Application.resjson" />
Expand All @@ -31,7 +39,8 @@
Tools extension to be activated for this project even if the Windows App SDK Nuget
package has not yet been restored.
-->
<ItemGroup Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ItemGroup
Condition="'$(DisableMsixProjectCapabilityAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
Expand All @@ -43,7 +52,8 @@
Explorer "Package and Publish" context menu entry to be enabled for this project even if
the Windows App SDK Nuget package has not yet been restored.
-->
<PropertyGroup Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<PropertyGroup
Condition="'$(DisableHasPackageAndPublishMenuAddedByProject)'!='true' and '$(EnableMsixTooling)'=='true'">
<HasPackageAndPublishMenu>true</HasPackageAndPublishMenu>
</PropertyGroup>
</Project>
</Project>
8 changes: 4 additions & 4 deletions E-Viewer/Properties/PublishProfiles/win10-arm64.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<RuntimeIdentifier>win10-arm64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<!--
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">false</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">true</PublishReadyToRun>
<!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
-->
Expand Down
8 changes: 4 additions & 4 deletions E-Viewer/Properties/PublishProfiles/win10-x64.pubxml
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121.
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
<PublishDir>bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\</PublishDir>
<SelfContained>true</SelfContained>
<PublishSingleFile>False</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">False</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">True</PublishReadyToRun>
<!--
<PublishSingleFile>false</PublishSingleFile>
<PublishReadyToRun Condition="'$(Configuration)' == 'Debug'">false</PublishReadyToRun>
<PublishReadyToRun Condition="'$(Configuration)' != 'Debug'">true</PublishReadyToRun>
<!--
See https://github.com/microsoft/CsWinRT/issues/373
<PublishTrimmed>True</PublishTrimmed>
-->
Expand Down
20 changes: 0 additions & 20 deletions E-Viewer/Properties/PublishProfiles/win10-x86.pubxml

This file was deleted.

0 comments on commit 42b8d19

Please sign in to comment.