diff --git a/.github/actions/compile/action.yml b/.github/actions/compile/action.yml
index a6609bd..597051e 100644
--- a/.github/actions/compile/action.yml
+++ b/.github/actions/compile/action.yml
@@ -36,6 +36,12 @@ inputs:
default: ${{ github.workspace }}
description: the working directory to run in
+ use-nuget-restore:
+ default: 'false'
+ description: >
+ Set to true if your project uses a packages.config file instead of packagereferences. Ensure the environment has
+ nuget and mono installed, either installing them manually or by using the Github Ubuntu-22.04 images
+
runs:
using: composite
steps:
@@ -68,9 +74,16 @@ runs:
- name: Restore Mod Solution
shell: bash
+ if: ${{ inputs.use-nuget-restore != 'true'}} # https://github.com/actions/runner/issues/1483 :sufferbeale:
working-directory: ${{ inputs.working-directory }}
run: dotnet restore ${{ inputs.solution-file-path }} ${{ runner.debug && '-v:diagnostic' }}
+ - name: Restore Mod Solution (NuGet)
+ shell: bash
+ if: ${{ inputs.use-nuget-restore == 'true'}}
+ working-directory: ${{ inputs.working-directory }}
+ run: nuget restore ${{ inputs.solution-file-path }} -Verbosity detailed
+
- name: Build Mod Solution
shell: bash
working-directory: ${{ inputs.working-directory }}
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index 7646ad9..748f8be 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -22,6 +22,12 @@ on:
description: >
If MSBuild should be used. If your mod has no msbuild project (e.g. a pure part mod)
you should set this to false
+ use-nuget-restore:
+ type: boolean
+ default: false
+ description: >
+ Set to true if your project uses a packages.config file instead of packagereferences. This will cause the job
+ to run on the Ubuntu-22.04 image instead of Ubuntu-24.04
use-ckan:
type: boolean
default: false
@@ -37,7 +43,7 @@ defaults:
jobs:
build:
- runs-on: ubuntu-22.04
+ runs-on: ${{ inputs.use-nuget-restore && 'ubuntu-22.04' || 'ubuntu-24.04' }}
steps:
- name: Checkout Mod Repo
uses: actions/checkout@v4
@@ -62,6 +68,7 @@ jobs:
ksp-zip-url: ${{ inputs.ksp-zip-url }}
ksp-zip-password: ${{ secrets.ksp-zip-password }}
solution-file-path: ${{ inputs.solution-file-path }}
+ use-nuget-restore: ${{ inputs.use-nuget-restore }}
# Assemble the mod into a release package and upload it as an artifact
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/assemble-release@0.0.4
diff --git a/.github/workflows/internal-ci.yml b/.github/workflows/internal-ci.yml
index aba53ca..838a2b5 100644
--- a/.github/workflows/internal-ci.yml
+++ b/.github/workflows/internal-ci.yml
@@ -65,6 +65,9 @@ jobs:
with:
package-version: ${{ needs.build.outputs.package-version }}
+ test-plugin-legacy:
+ uses: './.github/workflows/internal-test-plugin-legacy.yml'
+
test-assetbundle:
uses: './.github/workflows/internal-test-assetbundle.yml'
if: github.event_name != 'pull_request'
@@ -72,7 +75,7 @@ jobs:
deploy:
runs-on: ubuntu-22.04
- needs: [ build, test-plugin, test-plugin-nuget, test-assetbundle ]
+ needs: [ build, test-plugin, test-plugin-nuget, test-plugin-legacy, test-assetbundle ]
environment:
name: "NuGet"
url: "https://www.nuget.org/packages/KSPBuildTools"
diff --git a/.github/workflows/internal-test-plugin-legacy.yml b/.github/workflows/internal-test-plugin-legacy.yml
new file mode 100644
index 0000000..aefd25b
--- /dev/null
+++ b/.github/workflows/internal-test-plugin-legacy.yml
@@ -0,0 +1,27 @@
+# This is an internal test for KSPBuildTools and not intended to be used by other projects
+name: Test Plugin Mod (Legacy)
+
+on:
+ workflow_call:
+
+env:
+ TESTDIR: tests/plugin-mod-legacy
+
+jobs:
+ build:
+ runs-on: ubuntu-22.04
+ steps:
+ - uses: actions/checkout@v4
+
+ - uses: ./.github/actions/setup-ckan
+
+ - uses: ./.github/actions/compile
+ with:
+ ksp-zip-url: https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip
+ working-directory: ${{ env.TESTDIR }}
+ use-nuget-restore: true
+
+ - uses: ./.github/actions/assemble-release
+ with:
+ artifacts: ${{ env.TESTDIR }}/GameData
+ output-file-name: plugin-mod-legacy
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d3fd0e2..590dfbb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,6 +28,7 @@ All notable changes to this project will be documented in this file
### Actions
+- Added the `use-nuget-restore` option to the `compile` action to use the `nuget restore` command, for projects using packages.config files. This allows the `compile` action with default settings to work on any Ubuntu runner image
- Sped up `setup-ckan` action by skipping recommended packages and man-db updates
diff --git a/docs/actions/compile.md b/docs/actions/compile.md
index 995d733..3b532d7 100644
--- a/docs/actions/compile.md
+++ b/docs/actions/compile.md
@@ -6,7 +6,9 @@
```{warning}
Due to the [handover of the Mono project](https://github.com/mono/mono/issues/21796), the `ubuntu-latest` github runner [does not currently include mono or nuget](https://github.com/actions/runner-images/issues/10636#issuecomment-2375010324).
-Please use the `ubuntu-22.04` runner for this action.
+Please use the `ubuntu-22.04` runner image or install nuget yourself when `use-nuget-restore` is not `'true'`.
+
+This does not affect projects that use `packagereference`
```
````
\ No newline at end of file
diff --git a/tests/plugin-mod-legacy/.gitignore b/tests/plugin-mod-legacy/.gitignore
new file mode 100644
index 0000000..c29446b
--- /dev/null
+++ b/tests/plugin-mod-legacy/.gitignore
@@ -0,0 +1,4 @@
+packages
+obj
+bin
+GameData
\ No newline at end of file
diff --git a/tests/plugin-mod-legacy/PluginModLegacy.sln b/tests/plugin-mod-legacy/PluginModLegacy.sln
new file mode 100644
index 0000000..20a4cfd
--- /dev/null
+++ b/tests/plugin-mod-legacy/PluginModLegacy.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.0.31903.59
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "plugin-mod-legacy", "PluginModLegacy\plugin-mod-legacy.csproj", "{F19C7AB4-50C2-4378-9673-CC039CA12E10}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F19C7AB4-50C2-4378-9673-CC039CA12E10}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+EndGlobal
diff --git a/tests/plugin-mod-legacy/PluginModLegacy/Properties/AssemblyInfo.cs b/tests/plugin-mod-legacy/PluginModLegacy/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..9bf32e5
--- /dev/null
+++ b/tests/plugin-mod-legacy/PluginModLegacy/Properties/AssemblyInfo.cs
@@ -0,0 +1,10 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+// Information about this assembly is defined by the following attributes.
+// Change them to the values specific to your project.
+[assembly: AssemblyTitle ("PluginModLegacy")]
+[assembly: AssemblyDescription ("Test mod using a legacy csproj")]
+
+// This supposedly helps avoid plugin depencency problems.
+[assembly: KSPAssembly("plugin-mod-legacy", 1, 2, 3)]
\ No newline at end of file
diff --git a/tests/plugin-mod-legacy/PluginModLegacy/packages.config b/tests/plugin-mod-legacy/PluginModLegacy/packages.config
new file mode 100644
index 0000000..20174bf
--- /dev/null
+++ b/tests/plugin-mod-legacy/PluginModLegacy/packages.config
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/tests/plugin-mod-legacy/PluginModLegacy/plugin-mod-legacy.csproj b/tests/plugin-mod-legacy/PluginModLegacy/plugin-mod-legacy.csproj
new file mode 100644
index 0000000..72bb719
--- /dev/null
+++ b/tests/plugin-mod-legacy/PluginModLegacy/plugin-mod-legacy.csproj
@@ -0,0 +1,70 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {F19C7AB4-50C2-4378-9673-CC039CA12E10}
+ Library
+ JSI
+ PluginModMono
+ v4.8
+ 65001
+
+
+
+
+
+ true
+ portable
+ false
+ bin\Debug
+ DEBUG;
+ prompt
+ 4
+ false
+ AnyCPU
+ false
+
+
+ true
+ bin\Release
+ prompt
+ 4
+ false
+ AnyCPU
+ false
+ portable
+ true
+
+
+ Always
+
+
+ true
+ bin\Profile\
+ ENABLE_PROFILER
+ true
+ portable
+ AnyCPU
+ prompt
+ MinimumRecommendedRules.ruleset
+
+
+
+
+
+
+
+
+
+
+
+
+ This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.
+
+
+
+
+
+
\ No newline at end of file