diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..c00c546a --- /dev/null +++ b/.github/dependabot.yml @@ -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" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..d417795f --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 00000000..465f145a --- /dev/null +++ b/.github/workflows/check.yml @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 525d836d..00000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,100 +0,0 @@ -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: [x64, 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 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..7428edbe --- /dev/null +++ b/.github/workflows/release.yml @@ -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 diff --git a/.gitignore b/.gitignore index c262b618..6cf365f6 100644 --- a/.gitignore +++ b/.gitignore @@ -13,6 +13,7 @@ # Build results bin/ obj/ +out/ # Visual Studio cache/options directory .vs/ diff --git a/E-Viewer/E-Viewer-Key.pfx b/E-Viewer/E-Viewer-Key.pfx new file mode 100644 index 00000000..64b0bb8c Binary files /dev/null and b/E-Viewer/E-Viewer-Key.pfx differ diff --git a/E-Viewer/E-Viewer.csproj b/E-Viewer/E-Viewer.csproj index 762d8ab2..b5442c4e 100644 --- a/E-Viewer/E-Viewer.csproj +++ b/E-Viewer/E-Viewer.csproj @@ -6,15 +6,23 @@ Eviewer app.manifest x64;ARM64 - win10-x86;win10-x64;win10-arm64 + win10-x64;win10-arm64 win10-$(Platform).pubxml true - true + enable en + true + True AC82A857467374ACB64C3F8A542446485164DD50 + out\ True - enable - True + SHA256 + False + True + Never + True + False + 0 @@ -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. --> - + @@ -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. --> - + true - + \ No newline at end of file diff --git a/E-Viewer/Properties/PublishProfiles/win10-arm64.pubxml b/E-Viewer/Properties/PublishProfiles/win10-arm64.pubxml index a7fdd16b..d5b2134d 100644 --- a/E-Viewer/Properties/PublishProfiles/win10-arm64.pubxml +++ b/E-Viewer/Properties/PublishProfiles/win10-arm64.pubxml @@ -9,10 +9,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win10-arm64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true - False - False - True - diff --git a/E-Viewer/Properties/PublishProfiles/win10-x64.pubxml b/E-Viewer/Properties/PublishProfiles/win10-x64.pubxml index 26ea7e55..50a43100 100644 --- a/E-Viewer/Properties/PublishProfiles/win10-x64.pubxml +++ b/E-Viewer/Properties/PublishProfiles/win10-x64.pubxml @@ -9,10 +9,10 @@ https://go.microsoft.com/fwlink/?LinkID=208121. win10-x64 bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ true - False - False - True - diff --git a/E-Viewer/Properties/PublishProfiles/win10-x86.pubxml b/E-Viewer/Properties/PublishProfiles/win10-x86.pubxml deleted file mode 100644 index 34d14d4d..00000000 --- a/E-Viewer/Properties/PublishProfiles/win10-x86.pubxml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - FileSystem - x86 - win10-x86 - bin\$(Configuration)\$(TargetFramework)\$(RuntimeIdentifier)\publish\ - true - False - False - True - - - \ No newline at end of file