Releasing ModVerify #72
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: Releasing ModVerify | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| description: "The branch to a release to" | |
| required: true | |
| env: | |
| # Per-run release channel. Every other per-app value lives in update-tooling.jsonc and is loaded | |
| # into the environment by the "Load app config" step in each job below. | |
| BRANCH_NAME: ${{ github.event.inputs.branch || 'stable' }} | |
| jobs: | |
| # Builds and tests the solution. | |
| test: | |
| uses: ./.github/workflows/test.yml | |
| # End-to-end self-update test. | |
| integration-test: | |
| name: Integration test | |
| needs: [test] | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Run self-update integration suite | |
| shell: pwsh | |
| run: | | |
| $c = Get-Content -Raw ./update-tooling.jsonc | ConvertFrom-Json | |
| & "$($c.scriptsDir)/Test-LocalUpdateSuite.ps1" -ConfigPath ./update-tooling.jsonc | |
| pack: | |
| name: Pack | |
| needs: [test] | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Load app config | |
| shell: pwsh | |
| run: | | |
| $c = Get-Content -Raw ./update-tooling.jsonc | ConvertFrom-Json | |
| "TOOL_PROJ_PATH=$($c.toolProject)" >> $env:GITHUB_ENV | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| - name: Create NetFramework Release | |
| # use build for .NET Framework to enusre external updatere .EXE is included | |
| run: dotnet build ${{ env.TOOL_PROJ_PATH }} --configuration Release -f net481 --output ./releases/net481 /p:DebugType=None /p:DebugSymbols=false | |
| - name: Create Net Core Release | |
| # use publish for .NET Core | |
| run: dotnet publish ${{ env.TOOL_PROJ_PATH }} --configuration Release -f net10.0 --output ./releases/net10.0 /p:DebugType=None /p:DebugSymbols=false | |
| - name: Upload a Build Artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: Binary Releases | |
| path: ./releases | |
| if-no-files-found: error | |
| retention-days: 1 | |
| deploy: | |
| name: Deploy | |
| # Stable deploys are gated to 'main'. Non-stable channels (beta, canary, etc.) can be | |
| # workflow_dispatched from any branch. | |
| if: | | |
| (github.event_name == 'push' && github.ref == 'refs/heads/main') || | |
| (github.event_name == 'workflow_dispatch' && | |
| (github.event.inputs.branch != 'stable' || github.ref == 'refs/heads/main')) | |
| needs: [pack, integration-test] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout sources | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: Binary Releases | |
| path: ./releases | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Load app config | |
| shell: pwsh | |
| # Per-app release values come from update-tooling.jsonc. | |
| run: | | |
| $c = Get-Content -Raw ./update-tooling.jsonc | ConvertFrom-Json | |
| "PUBLISH_SCRIPT=$($c.scriptsDir)/Publish-Release.ps1" >> $env:GITHUB_ENV | |
| "TOOL_EXE=$($c.appExe)" >> $env:GITHUB_ENV | |
| "UPDATER_EXE=$($c.updaterExe)" >> $env:GITHUB_ENV | |
| "EMBEDDED_TRUST_CERT=$($c.embeddedTrustCert)" >> $env:GITHUB_ENV | |
| "ORIGIN_BASE=$($c.origin)" >> $env:GITHUB_ENV | |
| "SFTP_BASE_PATH=$($c.sftpBasePath)" >> $env:GITHUB_ENV | |
| "SFTP_HOST=$($c.sftpHost)" >> $env:GITHUB_ENV | |
| "SFTP_PORT=$($c.sftpPort)" >> $env:GITHUB_ENV | |
| "NEXT_ORIGIN_BASE=$($c.nextOrigin)" >> $env:GITHUB_ENV | |
| "NEXT_SFTP_BASE_PATH=$($c.nextSftpBasePath)" >> $env:GITHUB_ENV | |
| "COMPAT_UPDATER=$($c.compatUpdater)" >> $env:GITHUB_ENV | |
| - name: Publish self-update release | |
| shell: pwsh | |
| run: | | |
| & $env:PUBLISH_SCRIPT ` | |
| -AppExePath "./releases/net481/$env:TOOL_EXE" ` | |
| -UpdaterExePath "./releases/net481/$env:UPDATER_EXE" ` | |
| -EmbeddedTrustCertPath "$env:EMBEDDED_TRUST_CERT" ` | |
| -Origin "$env:ORIGIN_BASE" ` | |
| -SftpBasePath "$env:SFTP_BASE_PATH" ` | |
| -Branch "$env:BRANCH_NAME" ` | |
| -SigningPfxBase64 "${{ secrets.UPDATER_SIGNING_PFX_B64 }}" ` | |
| -SigningPfxPassword "${{ secrets.UPDATER_SIGNING_PFX_PASSWORD }}" ` | |
| -SftpHost "$env:SFTP_HOST" ` | |
| -SftpPort $env:SFTP_PORT ` | |
| -SftpUser "${{ secrets.SFTP_USER }}" ` | |
| -SftpPassword "${{ secrets.SFTP_PASSWORD }}" ` | |
| -NextOrigin "$env:NEXT_ORIGIN_BASE" ` | |
| -NextSftpBasePath "$env:NEXT_SFTP_BASE_PATH" ` | |
| -CompatibilityUpdaterExePath "$env:COMPAT_UPDATER" | |
| # Deploy .NET Core and .NET Framework apps to Github | |
| - name: Create NET Core .zip | |
| # Change into the artifacts directory to avoid including the directory itself in the zip archive | |
| working-directory: ./releases/net10.0 | |
| run: zip -r ../ModVerify-Net10.zip . | |
| - uses: dotnet/nbgv@v0.5.2 | |
| id: nbgv | |
| - name: Create GitHub release | |
| # Create a GitHub release on push to main only | |
| if: | | |
| github.ref == 'refs/heads/main' && github.event_name == 'push' | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| name: v${{ steps.nbgv.outputs.SemVer2 }} | |
| tag_name: v${{ steps.nbgv.outputs.SemVer2 }} | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| generate_release_notes: true | |
| files: | | |
| ./releases/net481/${{ env.TOOL_EXE }} | |
| ./releases/ModVerify-Net10.zip |