Debug-Build #35
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' | |
| - 'vercel.json' | |
| - 'CHANGELOG.md' | |
| - 'Extract-LatestChangelog.ps1' | |
| - 'extract-latest-changelog.sh' | |
| workflow_dispatch: | |
| env: | |
| Solution_Name: ShadowViewer | |
| jobs: | |
| prepare: | |
| runs-on: windows-latest | |
| outputs: | |
| VERSION: ${{ steps.get_version.outputs.VERSION }} | |
| PREVIEW: ${{ steps.get_version.outputs.PREVIEW }} | |
| CHANGELOG: ${{ steps.changelog.outputs.CHANGELOG }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get Version | |
| id: get_version | |
| shell: pwsh | |
| run: | | |
| [xml]$proj = Get-Content "$env:Solution_Name/Package.appxmanifest" | |
| $v = $proj.Package.Identity.Version | |
| $parts = $v.Split('.') | |
| $minor = [int]$parts[1] | |
| $build = [int]$parts[2] | |
| if ($build -ne 0) { | |
| echo "PREVIEW=1" >> $env:GITHUB_OUTPUT | |
| $minor = $minor + 1 | |
| $newVersion = "$($parts[0]).$minor-Preview$build" | |
| } else { | |
| echo "PREVIEW=0" >> $env:GITHUB_OUTPUT | |
| $newVersion = $v | |
| } | |
| echo "VERSION=$newVersion" >> $env:GITHUB_OUTPUT | |
| - name: Extract latest changelog (PowerShell script) | |
| id: changelog | |
| shell: pwsh | |
| run: | | |
| ./Extract-LatestChangelog.ps1 | |
| $content = Get-Content "LATEST_CHANGELOG.md" -Raw | |
| echo "CHANGELOG<<EOF" >> $env:GITHUB_OUTPUT | |
| echo $content >> $env:GITHUB_OUTPUT | |
| echo "EOF" >> $env:GITHUB_OUTPUT | |
| build: | |
| needs: prepare | |
| strategy: | |
| matrix: | |
| configuration: [Release] | |
| platform: [x64, x86, arm64] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| 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@v4 | |
| 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=${{ matrix.configuration }} | |
| - name: Decode the pfx | |
| shell: pwsh | |
| run: | | |
| $bytes = [Convert]::FromBase64String("${{ secrets.BASE64_ENCODED_PFX }}") | |
| [IO.File]::WriteAllBytes("GitHubActionsWorkflow.pfx", $bytes) | |
| - 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: Remove the pfx | |
| run: Remove-Item GitHubActionsWorkflow.pfx | |
| - name: Upload MSIX package | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ShadowViewer_${{ needs.prepare.outputs.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: | |
| - prepare | |
| - build | |
| env: | |
| VERSION: ${{ needs.prepare.outputs.VERSION }} | |
| PREVIEW: ${{ needs.prepare.outputs.PREVIEW }} | |
| CHANGELOG: ${{ needs.prepare.outputs.CHANGELOG }} | |
| steps: | |
| - name: Download x86 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ShadowViewer_${{ env.VERSION }}_x86 | |
| path: ./x86 | |
| - name: Download x64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ShadowViewer_${{ env.VERSION }}_x64 | |
| path: ./x64 | |
| - name: Download arm64 | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ShadowViewer_${{ env.VERSION }}_arm64 | |
| path: ./arm64 | |
| - name: Create ZIP package | |
| shell: pwsh | |
| run: | | |
| Compress-Archive -Path x86\* -DestinationPath ShadowViewer_${{ env.VERSION }}_x86.zip | |
| Compress-Archive -Path x64\* -DestinationPath ShadowViewer_${{ env.VERSION }}_x64.zip | |
| Compress-Archive -Path arm64\* -DestinationPath ShadowViewer_${{ 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 }} | |
| body: ${{ env.CHANGELOG }} | |
| files: | | |
| *.zip |