Showing with 137 additions and 3 deletions.
  1. +28 −0 .github/workflows/dotnet.yml
  2. +104 −0 .github/workflows/publish.yml
  3. +4 −2 ContentSettings/ContentSettings.csproj
  4. +1 −1 ContentSettings/Main.cs
28 changes: 28 additions & 0 deletions .github/workflows/dotnet.yml
@@ -0,0 +1,28 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: .NET

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
104 changes: 104 additions & 0 deletions .github/workflows/publish.yml
@@ -0,0 +1,104 @@
name: Publish

on:
release:
types: [ released, prereleased ]

jobs:
build:
name: build
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0
filter: tree:0

- name: Setup .NET Env
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.100"

- name: Restore Solution
run: |
dotnet restore
dotnet tool restore
- name: Pack Solution
run: |
dotnet pack --configuration Release
- name: Upload Thunderstore Artifact
uses: actions/upload-artifact@v4
with:
name: thunderstore-build
path: dist/*.zip

- name: Upload NuPkg Artifact
uses: actions/upload-artifact@v4
with:
name: nupkg-build
path: ContentSettings/bin/Release/*.nupkg

upload-release-artifacts:
needs: build
runs-on: ubuntu-latest
permissions: write-all
steps:
- uses: actions/checkout@v4

- name: Download all Artifacts
uses: actions/download-artifact@v4

- name: Upload artifacts to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload ${{ github.event.release.tag_name }} thunderstore-build/*.zip nupkg-build/*.nupkg

deploy-nuget:
name: Deploy to NuGet
needs: build
runs-on: ubuntu-latest
steps:
- name: Fetch Sources
uses: actions/checkout@v4

- name: Download nupkg artifact
uses: actions/download-artifact@v4
with:
name: nupkg-build
path: ./ContentSettings/bin/Release

- name: Setup .NET environment
uses: actions/setup-dotnet@v3
with:
dotnet-version: "8.0.100"

- name: Publish to NuGet.org
run: |
dotnet nuget push ./ContentSettings/bin/Release/*.nupkg --api-key ${{ secrets.NUGET_API_TOKEN }} --source https://api.nuget.org/v3/index.json
deploy-thunderstore:
if: ${{ github.event.release.prerelease == false }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download Thunderstore Artifact
uses: actions/download-artifact@v4
with:
name: thunderstore-build
path: ./dist

- name: Restore Tools
run: |
dotnet tool restore
- name: Publishing to Thunderstore
env:
TCLI_AUTH_TOKEN: ${{ secrets.THUNDERSTORE_API_TOKEN }}
run: |
dotnet tcli publish --config-path assets/thunderstore.toml --file dist/*.zip
6 changes: 4 additions & 2 deletions ContentSettings/ContentSettings.csproj
Expand Up @@ -30,6 +30,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Reference Include="0Harmony">
Expand All @@ -41,8 +42,9 @@
<Reference Include="Assembly-CSharp-firstpass">
<HintPath>E:\SteamLibrary\steamapps\common\Content Warning\Content Warning_Data\Managed\Assembly-CSharp-firstpass.dll</HintPath>
</Reference>
<Reference Include="Assembly-CSharp_publicized">
<HintPath>E:\SteamLibrary\steamapps\common\Content Warning\Content Warning_Data\Managed\publicized_assemblies\Assembly-CSharp_publicized.dll</HintPath>
<Reference Include="Assembly-CSharp_publicized, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\..\Downloads\publicized_assemblies\Assembly-CSharp_publicized.dll</HintPath>
</Reference>
<Reference Include="BepInEx">
<HintPath>E:\SteamLibrary\steamapps\common\Content Warning\BepInEx\core\BepInEx.dll</HintPath>
Expand Down
2 changes: 1 addition & 1 deletion ContentSettings/Main.cs
Expand Up @@ -11,7 +11,7 @@

namespace ContentSettings
{
[BepInPlugin("commander__cat.contentwarning.contentsettings", "ContentSettings", "0.0.1")]
[BepInPlugin("commander__cat.contentwarning.contentsettings", "ContentSettings", "1.0.0")]
public class Main : BaseUnityPlugin
{
public static Main instance { get; private set; }
Expand Down