|
1 | 1 | name: compile
|
| 2 | +description: > |
| 3 | + Compiles C# code using `msbuild` into a mod assembly. |
| 4 | + This action will install any dependent mods declared in the csproj file and restore NuGet packages. |
2 | 5 |
|
3 | 6 | inputs:
|
4 | 7 | build-configuration:
|
5 |
| - type: string |
6 | 8 | default: Release
|
| 9 | + description: The project configuration to build. Defaults to `Release`. |
| 10 | + |
7 | 11 | ksp-zip-url:
|
8 |
| - type: string |
9 | 12 | default: https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip
|
| 13 | + description: > |
| 14 | + A url for a zip file that contains the assemblies from the game to link against. This should either be stripped |
| 15 | + so that it only contains public interfaces, or encrypted so that the libraries are not being redistributed unprotected. |
| 16 | +
|
| 17 | + Defaults to `https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip` which contains stripped versions |
| 18 | + of the libraries and should be suitable for most users. It does not require a password. |
| 19 | +
|
10 | 20 | ksp-zip-password:
|
11 |
| - type: string |
12 |
| - dependency-identifiers: |
13 |
| - type: string |
14 |
| - msbuild-dependency-target: |
15 |
| - type: string |
| 21 | + description: > |
| 22 | + If the ksp library zip is encrypted, this is the password. It should be stored in your repository's secrets. |
| 23 | +
|
16 | 24 | solution-file-path:
|
17 |
| - type: string |
| 25 | + description: > |
| 26 | + The path to the solution file to build. Defaults to empty, which will invoke `msbuild` on the root directory of |
| 27 | + the repo and builds any `*.sln` file it finds there. |
| 28 | +
|
| 29 | + ckan-identifiers: |
| 30 | + description: Space-separated list of CKAN mod identifiers to install |
| 31 | + |
18 | 32 |
|
19 | 33 | runs:
|
20 | 34 | using: composite
|
21 | 35 | steps:
|
22 | 36 |
|
23 | 37 | - name: dump contexts
|
24 | 38 | shell: bash
|
25 |
| - if: env.ACTIONS_STEP_DEBUG |
| 39 | + if: runner.debug |
26 | 40 | run: |
|
27 | 41 | echo "${{ toJson(env) }}"
|
28 | 42 | echo "${{ toJson(github )}}"
|
29 | 43 | echo "${{ toJson(job) }}"
|
30 | 44 | echo "${{ toJson(steps) }}"
|
31 | 45 | printenv
|
32 | 46 |
|
| 47 | + - name: Set KSP_ROOT |
| 48 | + if: ${{ !env.KSP_ROOT }} |
| 49 | + shell: bash |
| 50 | + run: echo 'KSP_ROOT=${{ '/tmp/ksp' }}' >> "$GITHUB_ENV" |
| 51 | + |
33 | 52 | - name: Setup .NET
|
34 | 53 | uses: actions/setup-dotnet@v4
|
35 | 54 | with:
|
36 |
| - dotnet-version: 5.x |
| 55 | + dotnet-version: 7.x |
37 | 56 |
|
38 | 57 | - name: Install Dependencies
|
39 |
| - if: inputs.dependency-identifiers != '' || inputs.msbuild-dependency-target != '' |
40 |
| - uses: KSPModdingLibs/KSPBuildTools/.github/actions/install-dependencies@main |
41 |
| - with: |
42 |
| - dependency-identifiers: ${{ inputs.dependency-identifiers }} |
43 |
| - msbuild-dependency-target: ${{ inputs.msbuild-dependency-target }} |
44 |
| - solution-file-path: ${{ inputs.solution-file-path }} |
| 58 | + shell: bash |
| 59 | + if: ${{ inputs.depedency-identifiers }} |
| 60 | + run: ckan install --headless --no-recommends ${{ runner.debug && '--verbose' }} ${{ inputs.dependency-identifiers }} |
45 | 61 |
|
46 | 62 | - name: Download KSP Libs
|
47 | 63 | shell: bash
|
48 | 64 | run: |
|
49 | 65 | wget --quiet ${{ inputs.ksp-zip-url }} -O /tmp/ksp.zip
|
50 | 66 | unzip -q -P "${{ inputs.ksp-zip-password }}" /tmp/ksp.zip -d "${{ env.KSP_ROOT }}"
|
51 | 67 |
|
52 |
| - - name: Restore NuGet Packages |
| 68 | + - name: Restore Mod Solution |
53 | 69 | shell: bash
|
54 | 70 | working-directory: ${{ github.workspace }}
|
55 |
| - run: nuget restore ${{ inputs.solution-file-path }} |
| 71 | + run: dotnet restore ${{ inputs.solution-file-path }} ${{ runner.debug && '-v:detailed' }} |
56 | 72 |
|
57 | 73 | - name: Build Mod Solution
|
58 | 74 | shell: bash
|
59 | 75 | working-directory: ${{ github.workspace }}
|
60 |
| - run: msbuild /p:Configuration=${{ inputs.build-configuration }} /p:KSPRoot=${{ env.KSP_ROOT }} /p:ManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} |
61 |
| - |
| 76 | + run: | |
| 77 | + dotnet msbuild -p:Configuration=${{ inputs.build-configuration }} \ |
| 78 | + -p:ManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} \ |
| 79 | + ${{ runner.debug && '-v:detailed' }} |
0 commit comments