diff --git a/.github/workflows/ci-suite.yml b/.github/workflows/ci-suite.yml index d8ddcc6149..47e1f7686b 100644 --- a/.github/workflows/ci-suite.yml +++ b/.github/workflows/ci-suite.yml @@ -21,6 +21,9 @@ env: TGS_DOTNET_VERSION: 6.0.x TGS_TEST_GITHUB_TOKEN: ${{ secrets.LIVE_TESTS_TOKEN }} TGS_RELEASE_NOTES_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }} + WINGET_PUSH_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }} + PACKAGING_KEYGRIP: ${{ vars.PACKAGING_KEYGRIP }} + PACKAGING_PRIVATE_KEY_PASSPHRASE: ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }} CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} concurrency: @@ -899,9 +902,6 @@ jobs: ref: "refs/pull/${{ github.event.number }}/merge" - name: Execute Build Script - env: - PACKAGING_KEYGRIP: ${{ vars.PACKAGING_KEYGRIP }} - PACKAGING_PRIVATE_KEY_PASSPHRASE: ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }} run: sudo -E build/package/deb/build_package.sh - name: Parse TGS version @@ -964,6 +964,9 @@ jobs: with: ref: "refs/pull/${{ github.event.number }}/merge" + - name: Validate winget Manifest + run: winget validate --manifest build/package/winget/manifest + - name: Execute Build Script shell: powershell run: build/package/winget/build_msi.ps1 @@ -1333,3 +1336,36 @@ jobs: - name: Trigger tgstation-ppa workflow run: | curl -XPOST -u "${{ vars.DEV_PUSH_USERNAME }}:${{ secrets.DEV_PUSH_TOKEN }}" -H "Accept: application/vnd.github.everest-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/tgstation/tgstation-ppa/actions/workflows/add_tgs_version.yml/dispatches --data '{"ref":"main","inputs":{"tgs_semver": "${{ env.TGS_VERSION }}"}}' + + deploy-winget: + name: Deploy TGS (winget) + needs: deploy-tgs + if: "!(cancelled() || failure()) && needs.deploy-tgs.result == 'success'" + runs-on: ubuntu-latest + steps: + - name: Setup dotnet + uses: actions/setup-dotnet@v2 + with: + dotnet-version: ${{ env.TGS_DOTNET_VERSION }} + + - name: Install wingetcreate + run: winget install wingetcreate + + - name: Checkout + uses: actions/checkout@v3 + + - name: Build ReleaseNotes + run: dotnet build -c Release --project tools/ReleaseNotes + + - name: Retrieve .msi + uses: actions/download-artifact@v3 + with: + name: packaging-windows + path: packaging-windows + + - name: Execute Push Script + shell: powershell + run: build/package/winget/push_manifest.ps1 -MsiPath packaging-windows/tgstation-server.msi + + - name: Run ReleaseNotes with --link-winget + run: dotnet run -c Release --project tools/ReleaseNotes --link-winget ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} diff --git a/build/package/winget/build_msi.ps1 b/build/package/winget/build_msi.ps1 index 891ffbab4b..a1da7c23a5 100644 --- a/build/package/winget/build_msi.ps1 +++ b/build/package/winget/build_msi.ps1 @@ -4,24 +4,26 @@ Remove-Item -Recurse -Force -ErrorAction SilentlyContinue packaging git worktree remove -f packaging -$ErrorActionPreference="Stop" - git worktree add -f packaging $currentCommit cd packaging Remove-Item -Recurse -Force .git dotnet restore -[XML]$versionXML = Get-Content build/Version.props +[XML]$versionXML = Get-Content build/Version.props -ErrorAction Stop + $tgsVersion = $versionXML.Project.PropertyGroup.TgsCoreVersion cd build/package/winget $devVersion = '0.22.475' -(Get-Content Tgstation.Server.Host.Service.Msi/Tgstation.Server.Host.Service.Msi.vdproj).Replace($devVersion, $tgsVersion) | Set-Content Tgstation.Server.Host.Service.Msi/Tgstation.Server.Host.Service.Msi.vdproj +(Get-Content Tgstation.Server.Host.Service.Msi/Tgstation.Server.Host.Service.Msi.vdproj -ErrorAction Stop).Replace($devVersion, $tgsVersion) | Set-Content Tgstation.Server.Host.Service.Msi/Tgstation.Server.Host.Service.Msi.vdproj -ErrorAction Stop # We make _some_ assumptions DevEnv installer.sln /Project Tgstation.Server.Host.Service.Msi/Tgstation.Server.Host.Service.Msi.vdproj /build Release +if (-Not $?) { + exit $lastexitcode +} cd ../../../.. diff --git a/build/package/winget/manifest/Tgstation.Server.installer.yaml b/build/package/winget/manifest/Tgstation.Server.installer.yaml index 68b4a1457d..31f2517b77 100644 --- a/build/package/winget/manifest/Tgstation.Server.installer.yaml +++ b/build/package/winget/manifest/Tgstation.Server.installer.yaml @@ -2,14 +2,14 @@ # yaml-language-server: $schema=https://aka.ms/winget-manifest.installer.1.4.0.schema.json PackageIdentifier: Tgstation.Server -PackageVersion: 0.0.0 # Set before publish by wingetcreate +PackageVersion: 0.22.475 # Set before publish by push_manifest.ps1 Installers: -- InstallerUrl: https://github.com/tgstation/tgstation-server/releases/download/tgstation-server-v0.0.0/tgstation-server.msi # Set before publish by wingetcreate +- InstallerUrl: https://github.com/tgstation/tgstation-server/releases/download/tgstation-server-v0.22.475/tgstation-server.msi # Set before publish by push_manifest.ps1 InstallerLocale: en-US Architecture: x86 InstallerType: msi Scope: machine - InstallerSha256: F749672C1BDBAC8CD8AEF7352B97E54C21CF389D798D0ED245CA75EC72521460 + InstallerSha256: F749672C1BDBAC8CD8AEF7352B97E54C21CF389D798D0ED245CA75EC72521460 # Set before publish by push_manifest.ps1 InstallModes: - interactive - silent @@ -19,7 +19,6 @@ Installers: UnsupportedOSArchitectures: - arm - arm64 - ElevationRequirement: elevationRequired Dependencies: PackageDependencies: - PackageIdentifier: Microsoft.DotNet.AspNetCore.6 diff --git a/build/package/winget/manifest/Tgstation.Server.locale.en-US.yaml b/build/package/winget/manifest/Tgstation.Server.locale.en-US.yaml index 827c431db8..67b00590d8 100644 --- a/build/package/winget/manifest/Tgstation.Server.locale.en-US.yaml +++ b/build/package/winget/manifest/Tgstation.Server.locale.en-US.yaml @@ -2,11 +2,20 @@ # yaml-language-server: $schema=https://aka.ms/winget-manifest.defaultLocale.1.4.0.schema.json PackageIdentifier: Tgstation.Server -PackageVersion: 0.0.0 # Set before publish by wingetcreate +PackageVersion: 0.22.475 # Set before publish by push_manifest.ps1 PackageLocale: en-US Publisher: /tg/station 13 +PublisherUrl: https://github.com/tgstation/tgstation-server +PublisherSupportUrl: https://github.com/tgstation/tgstation-server/discussions/categories/q-a +Author: Dominion/Cyberboss PackageName: tgstation-server License: AGPL-3.0 ShortDescription: A production scale tool for BYOND server management +Moniker: tgstation-server +Documentations: + - DocumentLabel: README.md + DocumentUrl: https://github.com/tgstation/tgstation-server/blob/tgstation-server-v0.22.475/README.md +ReleaseNotesUrl: https://github.com/tgstation/tgstation-server/releases/tag/tgstation-server-v0.22.475 +PurchaseUrl: https://github.com/sponsors/Cyberboss ManifestType: defaultLocale ManifestVersion: 1.4.0 diff --git a/build/package/winget/manifest/Tgstation.Server.yaml b/build/package/winget/manifest/Tgstation.Server.yaml index e543e57585..c23541ad90 100644 --- a/build/package/winget/manifest/Tgstation.Server.yaml +++ b/build/package/winget/manifest/Tgstation.Server.yaml @@ -2,7 +2,7 @@ # yaml-language-server: $schema=https://aka.ms/winget-manifest.version.1.4.0.schema.json PackageIdentifier: Tgstation.Server -PackageVersion: 0.0.0 # Set before publish by wingetcreate +PackageVersion: 0.22.475 # Set before publish by push_manifest.ps1 DefaultLocale: en-US ManifestType: version ManifestVersion: 1.4.0 diff --git a/build/package/winget/push_manifest.ps1 b/build/package/winget/push_manifest.ps1 new file mode 100644 index 0000000000..f2a7154533 --- /dev/null +++ b/build/package/winget/push_manifest.ps1 @@ -0,0 +1,40 @@ +param( + [string]$MsiPath = 'packaging/build/package/winget/Tgstation.Server.Host.Service.Msi/Release/tgstation-server.msi' +) + +$ErrorActionPreference="Stop" + +[XML]$versionXML = Get-Content build/Version.props -ErrorAction Stop + +$tgsVersion = $versionXML.Project.PropertyGroup.TgsCoreVersion + +$installerHash = Get-FileHash -Path $MsiPath -ErrorAction Stop # SHA256 is the default + +cd build/package/winget/manifest + +$devHash = 'F749672C1BDBAC8CD8AEF7352B97E54C21CF389D798D0ED245CA75EC72521460' +$devVersion = '0.22.475' +$devReleaseDate = '2023-06-24' +$releaseDate = Get-Date -format "yyyy-MM-dd" + +(Get-Content Tgstation.Server.installer.yaml -ErrorAction Stop).Replace($devHash, $installerHash.Hash).Replace($devReleaseDate, $releaseDate).Replace($devVersion, $tgsVersion) | Set-Content Tgstation.Server.installer.yaml -ErrorAction Stop +(Get-Content Tgstation.Server.locale.en-US.yaml -ErrorAction Stop).Replace($devVersion, $tgsVersion) | Set-Content Tgstation.Server.locale.en-US.yaml -ErrorAction Stop +(Get-Content Tgstation.Server.yaml -ErrorAction Stop).Replace($devVersion, $tgsVersion) | Set-Content Tgstation.Server.yaml -ErrorAction Stop + +winget validate --manifest . +if (-Not $?) { + exit $lastexitcode +} + +# I know this is late, but we actually need the package online to install it +winget install -m . -h --disable-interactivity +if (-Not $?) { + exit $lastexitcode +} + +wingetcreate submit -t $Env:WINGET_PUSH_TOKEN . +if (-Not $?) { + exit $lastexitcode +} + +cd ../../../.. diff --git a/tgstation-server.sln b/tgstation-server.sln index 0e87b7b999..3e5c8b76c8 100644 --- a/tgstation-server.sln +++ b/tgstation-server.sln @@ -237,6 +237,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "winget", "winget", "{506B90 build\package\winget\installer.sln = build\package\winget\installer.sln build\package\winget\build_msi.ps1 = build\package\winget\build_msi.ps1 build\package\winget\install_banner.jpg = build\package\winget\install_banner.jpg + build\package\winget\push_manifest.ps1 = build\package\winget\push_manifest.ps1 EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "manifest", "manifest", "{3F141E03-6ABB-46A8-AA24-1B4B6814E58F}"