Merge pull request #1827 from tgstation/CIAdjustments

CI Improvements
This commit is contained in:
Jordan Dominion
2024-07-17 19:05:23 -04:00
committed by GitHub
24 changed files with 224 additions and 69 deletions
+2 -1
View File
@@ -73,7 +73,8 @@ For the full CI gambit, the following repository configuration must be set:
If you don't plan on deploying TGS, the following secrets can be omitted:
- Secret `DEV_PUSH_TOKEN`: A GitHub token with read/write access to the repository. Enables doxygen pushes to `gh-pages` branch, and releases creation.
- Secret `DEV_PUSH_TOKEN`: A repo scoped GitHub PAT with read/write access on the repository and the ability to trigger workflows on https://github.com/tgstation/tgstation-ppa. Used to trigger debian repo rebuilds, bypass rate limits, update milestones, and create winget package acceptance PRs.
- Secret `TGS_CI_GITHUB_APP_TOKEN_BASE64` is a base 64 encoded private key for a GitHub App. This app must be installed on the repo and have read/write access to checks and contents. Used to generate CI checks, push changelogs, and create releases.
- Secret `DOCKER_USERNAME`: Login username for Docker image push.
- Secret `DOCKER_PASSWORD`: Login password for Docker image push.
- Secret `NUGET_API_KEY`: Nuget.org API Key for client libraries push.
+52 -23
View File
@@ -42,7 +42,6 @@ env:
TGS_DOTNET_QUALITY: ga
TGS_TEST_GITHUB_TOKEN: ${{ secrets.LIVE_TESTS_TOKEN }}
TGS_RELEASE_NOTES_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
WINGET_PUSH_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
PACKAGING_PRIVATE_KEY_PASSPHRASE: ${{ secrets.PACKAGING_PRIVATE_KEY_PASSPHRASE }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
@@ -315,6 +314,12 @@ jobs:
mv $HOME/tgsdox/changelog.yml ./ 2>/dev/null
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --generate-full-notes
- name: Generate App Token
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: Patch Doxyfile
run: |
VERSION=$(cat "build/Version.props" | grep -oPm1 "(?<=<TgsCoreVersion>)[^<]+")
@@ -335,8 +340,8 @@ jobs:
echo ./doxout/* | xargs -n 10 sudo mv -t $HOME/tgsdox
cd $HOME/tgsdox
git config --global push.default simple
git config user.name "tgstation-server"
git config user.email "tgstation-server@tgstation13.org"
git config user.name "tgstation-server-ci[bot]"
git config user.email "847638+tgstation-server-ci[bot]@users.noreply.github.com"
echo '# THIS BRANCH IS AUTO GENERATED BY GITHUB ACTIONS' > README.md
# Need to create a .nojekyll file to allow filenames starting with an underscore
@@ -347,7 +352,7 @@ jobs:
echo "Committing..."
git diff-index --quiet HEAD || git commit -m "Deploy code docs to GitHub Pages for workflow run ${{ github.run_number }}" -m "Commit: ${{ github.event.head_commit.id }}"
echo "Pushing..."
git push -f "https://${{ secrets.DEV_PUSH_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
git push -f "https://${{ env.INSTALLATION_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
docker-build:
name: Build Docker Image
@@ -1233,7 +1238,7 @@ jobs:
- name: Install winget
uses: Cyberboss/install-winget@v1
with:
GITHUB_TOKEN: ${{ env.WINGET_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
- name: Setup dotnet
uses: actions/setup-dotnet@v4
@@ -1480,11 +1485,17 @@ jobs:
- name: Generate Release Notes
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes ${{ env.TGS_API_VERSION }} --httpapi
- name: Generate App Token
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
tag_name: api-v${{ env.TGS_API_VERSION }}
release_name: tgstation-server API v${{ env.TGS_API_VERSION }}
@@ -1494,7 +1505,7 @@ jobs:
- name: Upload OpenApi Spec
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./swagger/tgs_api.json
@@ -1543,11 +1554,17 @@ jobs:
- name: Generate Release Notes
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes ${{ env.TGS_DM_VERSION }} --dmapi
- name: Generate App Token
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
tag_name: dmapi-v${{ env.TGS_DM_VERSION }}
release_name: tgstation-server DMAPI v${{ env.TGS_DM_VERSION }}
@@ -1557,7 +1574,7 @@ jobs:
- name: Upload DMAPI Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DMAPI.zip
@@ -1637,7 +1654,7 @@ jobs:
run: dotnet build -c Release -p:TGS_HOST_NO_WEBPANEL=true tools/Tgstation.Server.ReleaseNotes/Tgstation.Server.ReleaseNotes.csproj
- name: Run ReleaseNotes with --ensure-release
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --ensure-release
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --ensure-release ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
deploy-tgs:
name: Deploy TGS
@@ -1760,11 +1777,17 @@ jobs:
- name: Generate Release Notes
run: dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes ${{ env.TGS_VERSION }}
- name: Generate App Token
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: Create GitHub Release
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
tag_name: tgstation-server-v${{ env.TGS_VERSION }}
release_name: tgstation-server-v${{ env.TGS_VERSION }}
@@ -1774,7 +1797,7 @@ jobs:
- name: Upload Server Console Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ServerConsole.zip
@@ -1784,7 +1807,7 @@ jobs:
- name: Upload Server Service Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ServerService.zip
@@ -1794,7 +1817,7 @@ jobs:
- name: Upload DMAPI Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./DMAPI.zip
@@ -1804,7 +1827,7 @@ jobs:
- name: Upload OpenApi Spec Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./swagger/tgs_api.json
@@ -1814,7 +1837,7 @@ jobs:
- name: Upload Server Update Package Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ServerUpdatePackage.zip
@@ -1824,7 +1847,7 @@ jobs:
- name: Upload Debian Pacakaging Artifact
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./packaging-debian/tgstation-server-v${{ env.TGS_VERSION }}.debian.packaging.tar.xz
@@ -1834,7 +1857,7 @@ jobs:
- name: Upload MariaDB .msi
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/package/winget/Tgstation.Server.Host.Service.Wix.Bundle/bin/Release/mariadb.msi
@@ -1844,7 +1867,7 @@ jobs:
- name: Upload Installer .exe
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ env.INSTALLATION_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./build/package/winget/tgstation-server-installer.exe
@@ -1880,6 +1903,12 @@ jobs:
mv $HOME/tgsdox/changelog.yml ./ 2>/dev/null
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --generate-full-notes
- name: Generate App Token
run: |
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: gh-pages Push
run: |
pushd $HOME/tgsdox
@@ -1888,13 +1917,13 @@ jobs:
sudo mv changelog.yml $HOME/tgsdox/
cd $HOME/tgsdox
git config --global push.default simple
git config user.name "tgstation-server"
git config user.email "tgstation-server@tgstation13.org"
git config user.name "tgstation-server-ci[bot]"
git config user.email "847638+tgstation-server-ci[bot]@users.noreply.github.com"
git add changelog.yml
echo "Committing..."
git diff-index --quiet HEAD || git commit -m "Regenerate changelog post deploy for workflow run ${{ github.run_number }}" -m "Commit: ${{ github.event.head_commit.id }}"
echo "Pushing..."
git push -f "https://${{ secrets.DEV_PUSH_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
git push -f "https://${{ env.INSTALLATION_TOKEN }}@github.com/tgstation/tgstation-server" 2>&1
deploy-docker:
name: Deploy TGS (Docker)
@@ -1954,7 +1983,7 @@ jobs:
- name: Install winget
uses: Cyberboss/install-winget@v1
with:
GITHUB_TOKEN: ${{ env.WINGET_PUSH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
- name: Install wingetcreate
run: winget install wingetcreate --version 1.2.8.0 --disable-interactivity --accept-source-agreements # Pinned due to breaking every other version
+28 -8
View File
@@ -6,18 +6,38 @@ on:
- master
workflow_dispatch:
env:
DEV_PUSH_TOKEN: ${{ secrets.DEV_PUSH_TOKEN }}
jobs:
master-merge:
name: Master Merge
runs-on: ubuntu-latest
steps:
- name: Checkout
- name: Build Checkout
uses: actions/checkout@v4
with:
path: temp_workspace
- name: Restore
run: |
cd temp_workspace
dotnet restore
- name: Build ReleaseNotes
run: |
cd temp_workspace
dotnet build -c Release -p:TGS_HOST_NO_WEBPANEL=true tools/Tgstation.Server.ReleaseNotes/Tgstation.Server.ReleaseNotes.csproj
- name: Generate App Token
run: |
cd temp_workspace
dotnet run -c Release --no-build --project tools/Tgstation.Server.ReleaseNotes --token-output-file ${{ runner.temp }}/installation_secret.txt ${{ secrets.TGS_CI_GITHUB_APP_TOKEN_BASE64 }}
echo "INSTALLATION_TOKEN=$(cat ${{ runner.temp }}/installation_secret.txt)" >> $GITHUB_ENV
rm ${{ runner.temp }}/installation_secret.txt
- name: Main Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.DEV_PUSH_TOKEN }}
token: ${{ env.INSTALLATION_TOKEN }}
- name: Merge master into dev
uses: robotology/gh-action-nightly-merge@14b4a4cf358f7479aa708bee05cf8a794d6a2516 #v1.5.0
@@ -26,8 +46,8 @@ jobs:
development_branch: 'dev'
allow_ff: true
allow_forks: true
user_name: tgstation-server
user_email: tgstation-server@users.noreply.github.com
push_token: DEV_PUSH_TOKEN
user_name: tgstation-server-ci[bot]
user_email: 847638+tgstation-server-ci[bot]@users.noreply.github.com
push_token: INSTALLATION_TOKEN
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+6
View File
@@ -0,0 +1,6 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<!-- Usage: Primary JSON library -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
+2 -2
View File
@@ -18,9 +18,9 @@
<!-- Pinned: Be VERY careful about updating https://github.com/moq/moq/issues/1372 -->
<PackageReference Include="Moq" Version="4.20.70" />
<!-- Usage: MSTest execution -->
<PackageReference Include="MSTest.TestAdapter" Version="3.4.3" />
<PackageReference Include="MSTest.TestAdapter" Version="3.5.0" />
<!-- Usage: MSTest asserts etc... -->
<PackageReference Include="MSTest.TestFramework" Version="3.4.3" />
<PackageReference Include="MSTest.TestFramework" Version="3.5.0" />
</ItemGroup>
</Project>
+2 -3
View File
@@ -1,5 +1,4 @@
using System;
using System.ComponentModel;
using System.ComponentModel;
using Tgstation.Server.Common;
@@ -8,7 +7,7 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Types of <see cref="Response.ErrorMessageResponse"/>s that the API may return.
/// </summary>
/// <remarks>Entries marked with the <see cref="ObsoleteAttribute"/> are no longer in use but kept for placeholders until they can be recycled in the next major API version.</remarks>
/// <remarks>Entries marked Obsolete are no longer in use but kept for placeholders until they can be recycled in the next major API version.</remarks>
public enum ErrorCode : uint
{
/// <summary>
@@ -1,5 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../build/NugetCommon.props" />
<Import Project="../../build/NewtonsoftJson.props" />
<PropertyGroup>
<TargetFramework>$(TgsNugetNetFramework)</TargetFramework>
@@ -27,9 +28,7 @@
<!-- Usage: HTTP constants reference -->
<PackageReference Include="Microsoft.AspNetCore.Http.Extensions" Version="2.2.0" />
<!-- Usage: Decoding the 'nbf' property of JWTs -->
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="7.6.2" />
<!-- Usage: Primary JSON library -->
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="8.0.0" />
<!-- Usage: Data model annotating -->
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
</ItemGroup>
@@ -11,14 +11,15 @@
<ItemGroup>
<!-- Usage: Connecting to SignalR hubs in API -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Client" Version="8.0.7" />
<!-- Usage: Using target JSON serializer for API -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.7" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Api\Tgstation.Server.Api.csproj" />
<ProjectReference Include="..\Tgstation.Server.Common\Tgstation.Server.Common.csproj" /> <!-- Needed for explicit nuget versioning -->
<!-- Already exists via TGS.Server.Api, but needed for explicit nuget versioning -->
<ProjectReference Include="..\Tgstation.Server.Common\Tgstation.Server.Common.csproj" />
</ItemGroup>
</Project>
@@ -21,6 +21,9 @@ namespace Tgstation.Server.Host.Common
public static IEnumerable<string> GetPotentialDotnetPaths(bool isWindows)
{
var enviromentPath = Environment.GetEnvironmentVariable("PATH");
if (enviromentPath == null)
return Enumerable.Empty<string>();
var paths = enviromentPath.Split(';');
var exeName = "dotnet";
@@ -4,6 +4,7 @@
<PropertyGroup>
<TargetFrameworks>$(TgsFrameworkVersion);net2.0</TargetFrameworks>
<Version>$(TgsCoreVersion)</Version>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
@@ -3,7 +3,7 @@
"isRoot": true,
"tools": {
"dotnet-ef": {
"version": "8.0.6",
"version": "8.0.7",
"commands": [
"dotnet-ef"
]
@@ -5,6 +5,7 @@ using Newtonsoft.Json.Serialization;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Host.Properties;
using Tgstation.Server.Shared;
namespace Tgstation.Server.Host.Components.Interop
{
@@ -50,7 +50,6 @@ using Tgstation.Server.Host.Controllers;
using Tgstation.Server.Host.Controllers.Results;
using Tgstation.Server.Host.Database;
using Tgstation.Server.Host.Extensions;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Host.IO;
using Tgstation.Server.Host.Jobs;
using Tgstation.Server.Host.Properties;
@@ -61,6 +60,7 @@ using Tgstation.Server.Host.Swarm;
using Tgstation.Server.Host.System;
using Tgstation.Server.Host.Transfer;
using Tgstation.Server.Host.Utils;
using Tgstation.Server.Shared;
namespace Tgstation.Server.Host.Core
{
@@ -23,11 +23,11 @@ using Npgsql;
using Tgstation.Server.Common;
using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Database;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Host.IO;
using Tgstation.Server.Host.Properties;
using Tgstation.Server.Host.System;
using Tgstation.Server.Host.Utils;
using Tgstation.Server.Shared;
using YamlDotNet.Serialization;
@@ -986,14 +986,15 @@ namespace Tgstation.Server.Host.Setup
{ SwarmConfiguration.Section, swarmConfiguration },
};
var versionConverter = new VersionConverter();
var builder = new SerializerBuilder()
.WithTypeConverter(new VersionConverter());
.WithTypeConverter(versionConverter);
if (userConfigFileName.EndsWith(".json", StringComparison.OrdinalIgnoreCase))
builder.JsonCompatible();
var serializer = new SerializerBuilder()
.WithTypeConverter(new VersionConverter())
.WithTypeConverter(versionConverter)
.Build();
var serializedYaml = serializer.Serialize(map);
@@ -3,6 +3,7 @@ using Newtonsoft.Json.Serialization;
using Tgstation.Server.Api;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Shared;
namespace Tgstation.Server.Host.Swarm
{
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="../../build/SrcCommon.props" />
<PropertyGroup>
@@ -77,24 +77,22 @@
<PackageReference Include="GitLabApiClient" Version="1.8.0" />
<!-- Usage: git interop -->
<PackageReference Include="LibGit2Sharp" Version="0.30.0" />
<!-- Usage: JWT injection into HTTP pipeline -->
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.6" />
<!-- Usage: Support ""legacy"" Newotonsoft.Json in HTTP pipeline. The rest of our codebase uses Newtonsoft. -->
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="8.0.7" />
<!-- Usage: Using target JSON serializer for API -->
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.6" />
<PackageReference Include="Microsoft.AspNetCore.SignalR.Protocols.NewtonsoftJson" Version="8.0.7" />
<!-- Usage: Generating dumps of dotnet engine processes -->
<PackageReference Include="Microsoft.Diagnostics.NETCore.Client" Version="0.2.532401" />
<!-- Usage: Database ORM -->
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.7" />
<!-- Usage: Automatic migration generation using command line -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.6">
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.7">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<!-- Usage: Sqlite ORM plugin -->
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.7" />
<!-- Usage: MSSQL ORM plugin -->
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.6" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.7" />
<!-- Usage: POSIX support for syscalls, signals, and symlinks -->
<PackageReference Include="Mono.Posix.NETStandard" Version="1.0.0" />
<PackageReference Include="NCrontab.Signed" Version="3.3.3" />
@@ -102,8 +100,6 @@
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<!-- Usage: PostgresSQL ORM plugin -->
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<!-- Usage: GitHub.com interop -->
<PackageReference Include="Octokit" Version="13.0.0" />
<!-- Usage: MYSQL/MariaDB ORM plugin -->
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<!-- Usage: Discord interop -->
@@ -135,6 +131,7 @@
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Api\Tgstation.Server.Api.csproj" />
<ProjectReference Include="..\Tgstation.Server.Host.Common\Tgstation.Server.Host.Common.csproj" />
<ProjectReference Include="..\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj" />
</ItemGroup>
<ItemGroup>
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../build/Common.props" />
<Import Project="../../build/NewtonsoftJson.props" />
<PropertyGroup>
<TargetFramework>$(TgsFrameworkVersion)</TargetFramework>
<Version>$(TgsCoreVersion)</Version>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<!-- Usage: JWT injection into HTTP pipeline -->
<PackageReference Include="Microsoft.AspNetCore.Authentication.JwtBearer" Version="8.0.7" />
<!-- Usage: GitHub.com interop -->
<PackageReference Include="Octokit" Version="13.0.1" />
<!-- Usage: YAML conversion of Version objects -->
<PackageReference Include="YamlDotNet" Version="16.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Tgstation.Server.Common\Tgstation.Server.Common.csproj" />
</ItemGroup>
</Project>
@@ -8,7 +8,7 @@ using YamlDotNet.Core;
using YamlDotNet.Core.Events;
using YamlDotNet.Serialization;
namespace Tgstation.Server.Host.Extensions.Converters
namespace Tgstation.Server.Shared
{
/// <summary>
/// <see cref="JsonConverter"/> and <see cref="IYamlTypeConverter"/> for serializing <see cref="global::System.Version"/>s in semver format.
@@ -85,10 +85,10 @@ namespace Tgstation.Server.Host.Extensions.Converters
public bool Accepts(Type type) => CheckSupportsType(type, false);
/// <inheritdoc />
public object ReadYaml(IParser parser, Type type) => throw new NotSupportedException("Deserialization not supported!"); // The default implementation is fine at handling this
public object ReadYaml(IParser parser, Type type, ObjectDeserializer rootDeserializer) => throw new NotSupportedException("Deserialization not supported!"); // The default implementation is fine at handling this
/// <inheritdoc />
public void WriteYaml(IEmitter? emitter, object? value, Type type)
public void WriteYaml(IEmitter? emitter, object? value, Type type, ObjectSerializer serializer)
{
ArgumentNullException.ThrowIfNull(emitter);
@@ -6,6 +6,7 @@
</PropertyGroup>
<ItemGroup>
<!-- Usage: Creating mock database implementations -->
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="8.0.6" />
</ItemGroup>
@@ -1,11 +1,12 @@
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tgstation.Server.Common.Extensions;
using YamlDotNet.Serialization;
namespace Tgstation.Server.Host.Extensions.Converters.Tests
namespace Tgstation.Server.Shared.Tests
{
[TestClass]
public sealed class TestVersionConverter
@@ -0,0 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="../../build/TestCommon.props" />
<PropertyGroup>
<TargetFramework>$(TgsFrameworkVersion)</TargetFramework>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj" />
</ItemGroup>
</Project>
+31 -1
View File
@@ -29,6 +29,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{6FF654E6
build\Dockerfile = build\Dockerfile
build\GenerateMigrations.sh = build\GenerateMigrations.sh
build\logo.svg = build\logo.svg
build\NewtonsoftJson.props = build\NewtonsoftJson.props
build\NugetCommon.props = build\NugetCommon.props
build\OpenApiValidationSettings.json = build\OpenApiValidationSettings.json
build\SrcCommon.props = build\SrcCommon.props
@@ -261,7 +262,11 @@ Project("{B7DD6F7E-DEF8-4E67-B5B7-07EF123DB6F0}") = "Tgstation.Server.Host.Servi
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.ReleaseNotes", "tools\Tgstation.Server.ReleaseNotes\Tgstation.Server.ReleaseNotes.csproj", "{69944039-65C2-40E1-9D86-0608FA0C2D70}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tgstation.Server.LogoGenerator", "tools\Tgstation.Server.LogoGenerator\Tgstation.Server.LogoGenerator.csproj", "{7F7FCFDF-271D-45C2-830C-BCCB19C57077}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.LogoGenerator", "tools\Tgstation.Server.LogoGenerator\Tgstation.Server.LogoGenerator.csproj", "{7F7FCFDF-271D-45C2-830C-BCCB19C57077}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Shared", "src\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj", "{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tgstation.Server.Shared.Tests", "tests\Tgstation.Server.Shared.Tests\Tgstation.Server.Shared.Tests.csproj", "{EAB84FD0-5514-4254-B188-7D90ACB7284D}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -533,6 +538,30 @@ Global
{7F7FCFDF-271D-45C2-830C-BCCB19C57077}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{7F7FCFDF-271D-45C2-830C-BCCB19C57077}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{7F7FCFDF-271D-45C2-830C-BCCB19C57077}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Debug|Any CPU.Build.0 = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWindows|Any CPU.ActiveCfg = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWindows|Any CPU.Build.0 = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWix|Any CPU.ActiveCfg = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.DebugNoWix|Any CPU.Build.0 = Debug|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Release|Any CPU.ActiveCfg = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.Release|Any CPU.Build.0 = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWindows|Any CPU.ActiveCfg = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{74B9AC97-DEEC-49F4-B3B3-E07126A52B47}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWindows|Any CPU.ActiveCfg = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWindows|Any CPU.Build.0 = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWix|Any CPU.ActiveCfg = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.DebugNoWix|Any CPU.Build.0 = Debug|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.Release|Any CPU.Build.0 = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWindows|Any CPU.ActiveCfg = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWindows|Any CPU.Build.0 = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWix|Any CPU.ActiveCfg = Release|Any CPU
{EAB84FD0-5514-4254-B188-7D90ACB7284D}.ReleaseNoWix|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -571,6 +600,7 @@ Global
{9E66C6F1-E235-4979-83B5-C2B3FDAD6E01} = {506B9092-AF88-4DA2-84FD-C11646B695B0}
{69944039-65C2-40E1-9D86-0608FA0C2D70} = {A55C1117-5808-4AB2-BEA6-4D4A3E66A2F2}
{7F7FCFDF-271D-45C2-830C-BCCB19C57077} = {A55C1117-5808-4AB2-BEA6-4D4A3E66A2F2}
{EAB84FD0-5514-4254-B188-7D90ACB7284D} = {316141B0-CD21-4769-A013-D53DA9B9EC09}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {DFD36C95-3E49-41C7-ACDB-86BAF5B18A79}
+30 -2
View File
@@ -25,7 +25,7 @@ using Newtonsoft.Json;
using Octokit;
using Octokit.GraphQL;
using Tgstation.Server.Host.Extensions.Converters;
using Tgstation.Server.Shared;
using YamlDotNet.Serialization;
@@ -61,6 +61,7 @@ namespace Tgstation.Server.ReleaseNotes
var fullNotes = versionString.Equals("--generate-full-notes", StringComparison.OrdinalIgnoreCase);
var nuget = versionString.Equals("--nuget", StringComparison.OrdinalIgnoreCase);
var ciCompletionCheck = versionString.Equals("--ci-completion-check", StringComparison.OrdinalIgnoreCase);
var genToken = versionString.Equals("--token-output-file", StringComparison.OrdinalIgnoreCase);
if ((!Version.TryParse(versionString, out var version) || version.Revision != -1)
&& !ensureRelease
@@ -68,7 +69,8 @@ namespace Tgstation.Server.ReleaseNotes
&& !shaCheck
&& !fullNotes
&& !nuget
&& !ciCompletionCheck)
&& !ciCompletionCheck
&& !genToken)
{
Console.WriteLine("Invalid version: " + versionString);
return 2;
@@ -126,7 +128,17 @@ namespace Tgstation.Server.ReleaseNotes
try
{
if (ensureRelease)
{
if (args.Length < 2)
{
Console.WriteLine("Missing PEM Base64 for updating release!");
return 454233;
}
await GenerateAppCredentials(client, args[1]);
return await EnsureRelease(client);
}
if (linkWinget)
{
@@ -150,6 +162,22 @@ namespace Tgstation.Server.ReleaseNotes
return await CICompletionCheck(client, args[1], args[2]);
}
if (genToken)
{
if (args.Length < 3)
{
Console.WriteLine("Missing output file path or PEM Base64 for app authentication!");
return 33847;
}
await GenerateAppCredentials(client, args[2]);
var token = client.Credentials.GetToken();
await File.WriteAllTextAsync(args[1], token);
return 0;
}
if (shaCheck)
{
if(args.Length < 2)
@@ -12,7 +12,7 @@
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Tgstation.Server.Host\Tgstation.Server.Host.csproj" />
<ProjectReference Include="..\..\src\Tgstation.Server.Shared\Tgstation.Server.Shared.csproj" />
</ItemGroup>
</Project>