Debug-Build #26
This file contains hidden or 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: Debug-Build | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths-ignore: | |
| - '.github/**' | |
| - '.editorconfig' | |
| - '.gitattributes' | |
| - '.gitignore' | |
| - '.gitmodules' | |
| - 'LICENSE.txt' | |
| - 'README.md' | |
| - 'README_EN.md' | |
| - 'ShadowViewer.sln' | |
| - 'vercel.json' | |
| workflow_dispatch: | |
| env: | |
| Solution_Name: ShadowViewer | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| configuration: [Release] | |
| platform: [x64, x86, arm64] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Delay | |
| run: sleep 10 | |
| - uses: mickem/clean-after-action@v1 | |
| - name: Checkout | |
| uses: actions/checkout@v2 | |
| with: | |
| submodules: recursive | |
| fetch-depth: 0 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.nuget/packages | |
| key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-nuget- | |
| - name: Install .NET | |
| uses: actions/setup-dotnet@v1 | |
| with: | |
| dotnet-version: | | |
| 9.0.x | |
| - name: Setup MSBuild.exe | |
| uses: microsoft/setup-msbuild@v2 | |
| - name: Restore the application | |
| run: msbuild $env:Solution_Name/$env:Solution_Name.csproj /t:Restore /p:Configuration=$env:Configuration /p:GithubAction=true /p:MainGithubAction=true | |
| env: | |
| Configuration: ${{ matrix.configuration }} | |
| - name: Decode the pfx | |
| run: | | |
| $pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}") | |
| $certificatePath = "GitHubActionsWorkflow.pfx" | |
| [IO.File]::WriteAllBytes("$certificatePath", $pfx_cert_byte) | |
| - name: Create the app package | |
| run: msbuild $env:Solution_Name/$env:Solution_Name.csproj /p:Configuration=$env:Configuration /p:Platform=$env:Platform /p:UapAppxPackageBuildMode=$env:Appx_Package_Build_Mode /p:AppxBundle=$env:Appx_Bundle /p:PackageCertificateKeyFile=../GitHubActionsWorkflow.pfx /p:AppxPackageDir="$env:Appx_Package_Dir" /p:GithubAction=true /p:MainGithubAction=true | |
| env: | |
| Appx_Bundle: Never | |
| Appx_Package_Build_Mode: SideloadOnly | |
| Appx_Package_Dir: ..\Packages\ | |
| Configuration: ${{ matrix.configuration }} | |
| Platform: ${{ matrix.platform }} | |
| - name: Get Version | |
| shell: pwsh | |
| run: | | |
| [xml]$proj = Get-Content "$env:Solution_Name/Package.appxmanifest" | |
| $v = $proj.Package.Identity.Version | |
| $parts = $v.Split('.') | |
| $major = [int]$parts[0] | |
| $minor = [int]$parts[1] | |
| $build = [int]$parts[2] | |
| $revision = [int]$parts[3] | |
| $newVersion = $v | |
| if ($build -ne 0) { | |
| $minor = $minor + 1 | |
| $newVersion = "$major.$minor-Preview$build" | |
| echo "Preview=1" >> $env:GITHUB_ENV | |
| } | |
| echo "VERSION=$newVersion" >> $env:GITHUB_ENV | |
| - name: Remove the pfx | |
| run: | | |
| Remove-Item -path GitHubActionsWorkflow.pfx | |
| - name: Upload MSIX package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ${{ env.Solution_Name }}_${{ env.VERSION }}_${{ matrix.platform }} | |
| path: | | |
| Packages/${{ env.Solution_Name }}*/*.* | |
| Packages/${{ env.Solution_Name }}*/Add-AppDevPackage.resources | |
| Packages/${{ env.Solution_Name }}*/Dependencies/${{ matrix.platform }}/*.* | |
| release: | |
| runs-on: windows-latest | |
| needs: build | |
| steps: | |
| - name: x86 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.Solution_Name }}_${{ env.VERSION }}_x86 | |
| path: ./x86 | |
| - name: x64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.Solution_Name }}_${{ env.VERSION }}_x64 | |
| path: ./x64 | |
| - name: arm64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ${{ env.Solution_Name }}_${{ env.VERSION }}_arm64 | |
| path: ./arm64 | |
| - name: Create ZIP package | |
| shell: pwsh | |
| run: | | |
| Compress-Archive -Path x86\* -DestinationPath ${{ env.Solution_Name }}_${{ env.VERSION }}_x86.zip | |
| Compress-Archive -Path x64\* -DestinationPath ${{ env.Solution_Name }}_${{ env.VERSION }}_x64.zip | |
| Compress-Archive -Path arm64\* -DestinationPath ${{ env.Solution_Name }}_${{ env.VERSION }}_arm64.zip | |
| - name: Create GitHub Pre-release | |
| if: env.Preview == '1' | |
| uses: marvinpinto/action-automatic-releases@latest | |
| with: | |
| repo_token: "${{ secrets.RELEASE_TOKEN }}" | |
| automatic_release_tag: ${{ env.VERSION }} | |
| prerelease: true | |
| title: ${{ env.VERSION }} | |
| files: | | |
| *.zip |