Skip to content

Commit c72a7d1

Browse files
authored
Merge pull request #66 from KSPModdingLibs/next
WIP: Version 1.0.0
2 parents 5f2889a + 71216db commit c72a7d1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+1641
-677
lines changed

.github/actions/assemble-release/action.yml

Lines changed: 16 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Assemble Release
22

33
x-env:
44
RELEASE_STAGING:
5-
description: The artifact files will be copied to this directory before being packaged in the zip file. This becomes the input for `upload-artifact`. If not set, `/tmp/release` is used instead
5+
description: The artifact files will be copied to this directory before being packaged in the zip file. If not set, `/tmp/release` is used instead
66

77
inputs:
88
artifacts:
@@ -14,7 +14,7 @@ inputs:
1414
default: "**/*.pdb"
1515

1616
output-file-name:
17-
description: Output artifact name used in the upload-artifact action. a zip file with this name will be created in the github workspace so that it can be immediately consumed by other actions in the workflow without having to download the artifact.
17+
description: Output artifact name used in the upload-artifact action WITHOUT ".zip" extension. a zip file with this name will be created in the github workspace so that it can be immediately consumed by other actions in the workflow without having to download the artifact.
1818
default: ${{ github.event.repository.name || 'release'}}
1919

2020
working-directory:
@@ -30,17 +30,21 @@ outputs:
3030
value: ${{ steps.upload-artifact.outputs.artifact-url }}
3131
description: Artifact URL from the upload-artifact action
3232

33-
artifact-path:
34-
value: ${{ steps.assemble-release.outputs.artifact-path }}
35-
description: Local path to the produced zip file
33+
artifact-zip-path:
34+
value: ${{ steps.assemble-release.outputs.artifact-zip-path }}
35+
description: Local path to the produced release zip file
36+
37+
artifact-dir-path:
38+
value: ${{ steps.assemble-release.outputs.artifact-dir-path }}
39+
description: Local path to the produced release directory
3640

3741
runs:
3842
using: composite
3943
steps:
4044
- name: Set RELEASE_STAGING
4145
if: ${{ !env.RELEASE_STAGING}}
4246
shell: bash
43-
run: echo 'RELEASE_STAGING=${{ '/tmp/release' }}' >> "$GITHUB_ENV"
47+
run: echo 'RELEASE_STAGING=/tmp/release/' >> "$GITHUB_ENV"
4448

4549
- name: Copy Files to Staging
4650
shell: bash
@@ -49,25 +53,16 @@ runs:
4953
shopt -s nocaseglob # so globs are case-insensitive
5054
shopt -s globstar
5155
shopt -s nullglob
52-
mkdir -p ${{ env.RELEASE_STAGING }}
53-
cp -r -v ${{ inputs.artifacts }} ${{ env.RELEASE_STAGING }}
54-
cd ${{ env.RELEASE_STAGING }}
56+
mkdir -p ${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}
57+
cp -r -v ${{ inputs.artifacts }} ${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}
58+
cd ${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}
5559
rm -f ${{ inputs.artifacts-exclude }}
5660
5761
- name: Assemble Release
5862
id: assemble-release
5963
shell: bash
6064
working-directory: ${{ env.RELEASE_STAGING }}
6165
run: |
62-
zip -r ${{ github.workspace }}/${{ inputs.output-file-name }}.zip .
63-
echo 'ARTIFACT_FILENAME=${{ inputs.output-file-name }}' >> $GITHUB_ENV
64-
echo 'artifact-path=${{ github.workspace }}/${{ inputs.output-file-name }}' >> $GITHUB_OUTPUT
65-
66-
- name: Upload Artifact
67-
id: upload-artifact
68-
uses: actions/upload-artifact@v4
69-
with:
70-
path: ${{ env.RELEASE_STAGING }}
71-
name: ${{ inputs.output-file-name }}
72-
if-no-files-found: error
73-
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`
66+
zip -r ${{ inputs.output-file-name }}.zip ${{ inputs.output-file-name}}
67+
echo 'artifact-zip-path=${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name }}.zip' >> $GITHUB_OUTPUT
68+
echo 'artifact-dir-path=${{ env.RELEASE_STAGING }}/${{ inputs.output-file-name}}' >> $GITHUB_OUTPUT

.github/actions/compile/action.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@ inputs:
1010
default: Release
1111
description: The project configuration to build.
1212

13-
dotnet-version:
14-
default: 5.x
15-
description: Version of dotnet compiler to use. Defaults to 5.x.
16-
1713
ksp-zip-url:
1814
default: https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip
1915
description: >
@@ -36,6 +32,12 @@ inputs:
3632
default: ${{ github.workspace }}
3733
description: the working directory to run in
3834

35+
use-nuget-restore:
36+
default: 'false'
37+
description: >
38+
Set to true if your project uses a packages.config file instead of packagereferences. Ensure the environment has
39+
nuget and mono installed, either installing them manually or by using the Github Ubuntu-22.04 images
40+
3941
runs:
4042
using: composite
4143
steps:
@@ -55,11 +57,6 @@ runs:
5557
shell: bash
5658
run: echo 'KSP_ROOT=${{ '/tmp/ksp' }}' >> "$GITHUB_ENV"
5759

58-
- name: Setup .NET
59-
uses: actions/setup-dotnet@v4
60-
with:
61-
dotnet-version: ${{ inputs.dotnet-version }}
62-
6360
- name: Download KSP Libs
6461
shell: bash
6562
run: |
@@ -68,13 +65,20 @@ runs:
6865
6966
- name: Restore Mod Solution
7067
shell: bash
68+
if: ${{ inputs.use-nuget-restore != 'true'}} # https://github.com/actions/runner/issues/1483 :sufferbeale:
69+
working-directory: ${{ inputs.working-directory }}
70+
run: dotnet restore ${{ inputs.solution-file-path }} ${{ runner.debug && '-v:diagnostic' }}
71+
72+
- name: Restore Mod Solution (NuGet)
73+
shell: bash
74+
if: ${{ inputs.use-nuget-restore == 'true'}}
7175
working-directory: ${{ inputs.working-directory }}
7276
run: nuget restore ${{ inputs.solution-file-path }} -Verbosity detailed
7377

7478
- name: Build Mod Solution
7579
shell: bash
7680
working-directory: ${{ inputs.working-directory }}
77-
run: |
78-
dotnet msbuild -m:1 -p:Configuration=${{ inputs.build-configuration }} \
79-
-p:ManagedRelativePath=KSP_x64_Data/Managed ${{ inputs.solution-file-path }} \
80-
${{ runner.debug && '-v:detailed' }}
81+
run: >
82+
dotnet msbuild -m:1 -p:Configuration=${{ inputs.build-configuration }}
83+
-p:KSPBT_ManagedPath=${{ env.KSP_ROOT }}/KSP_x64_Data/Managed ${{ inputs.solution-file-path }}
84+
${{ runner.debug && '-v:diagnostic' }}

.github/actions/setup-ckan/action.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ x-env:
66
description: The path to use as the root of a KSP instance for CKAN to set-up. If not set, `/tmp/ksp` is used instead.
77

88
inputs:
9+
ckan-install-method:
10+
description: Method of installing CKAN. Can be set to 'apt' to install from the official .deb file, or 'skip' to skip installation if your runner already has CKAN installed.
11+
default: 'apt'
12+
913
ckan-version:
1014
description: CKAN tag to install. set to an empty string to always install the most recent version. See [the CKAN releases page](https://github.com/KSP-CKAN/CKAN/tags) for a list of available tags
1115
default: ''
@@ -42,24 +46,26 @@ runs:
4246
shell: bash
4347
run: echo 'KSP_ROOT=${{ '/tmp/ksp' }}' >> "$GITHUB_ENV"
4448

45-
- name: Install CKAN
49+
- name: Install CKAN via apt
50+
if: ${{ inputs.ckan-install-method == 'apt' }}
4651
shell: bash
4752
run: |
53+
sudo rm -f /var/lib/man-db/auto-update # skip updating man pages, which takes a long time and makes no sense in a CI job
4854
gh release download ${{ inputs.ckan-version }} --repo ${{ inputs.ckan-repo }} --pattern 'ckan*.deb' -O ckan.deb
4955
${{ env.ACT && 'sudo apt update --quiet' }}
50-
sudo apt install --quiet ./ckan.deb ${{ runner.debug && '--verbose-versions' }}
56+
sudo apt install --quiet --no-install-recommends --no-install-suggests ./ckan.deb ${{ runner.debug && '--verbose-versions' }}
5157
ckan version
5258
env:
5359
GH_TOKEN: ${{ github.token }}
5460

55-
- name: Setup CKAN Instance
61+
- name: Setup fake KSP instance
5662
shell: bash
5763
run: |
5864
${{ runner.debug && 'echo "$PATH"' }}
5965
ckan instance fake --set-default KSP ${{ env.KSP_ROOT }} 1.12.5 --game KSP --MakingHistory 1.9.1 --BreakingGround 1.7.1 ${{ runner.debug && '--verbose' }}
6066
ckan update
6167
62-
- name: Setup CKAN Compatible Versions
68+
- name: Setup CKAN compatible versions
6369
shell: bash
6470
if: inputs.ckan-compatible-versions != ''
6571
run: |
@@ -69,7 +75,7 @@ runs:
6975
env:
7076
VERSIONS: ${{ inputs.ckan-compatible-versions }}
7177

72-
- name: Setup CKAN Filter
78+
- name: Setup CKAN filter
7379
shell: bash
7480
if: inputs.ckan-filters != ''
7581
run: |

.github/workflows/build.yml

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@ on:
2222
description: >
2323
If MSBuild should be used. If your mod has no msbuild project (e.g. a pure part mod)
2424
you should set this to false
25+
use-nuget-restore:
26+
type: boolean
27+
default: false
28+
description: >
29+
Set to true if your project uses a packages.config file instead of packagereferences. This will cause the job
30+
to run on the Ubuntu-22.04 image instead of Ubuntu-24.04
31+
dotnet-version:
32+
type: string
33+
default: 8.x
34+
description: Version of dotnet compiler to use.
2535
use-ckan:
2636
type: boolean
2737
default: false
@@ -37,34 +47,50 @@ defaults:
3747

3848
jobs:
3949
build:
40-
runs-on: ubuntu-22.04
50+
runs-on: ${{ inputs.use-nuget-restore && 'ubuntu-22.04' || 'ubuntu-24.04' }}
4151
steps:
4252
- name: Checkout Mod Repo
4353
uses: actions/checkout@v4
4454
with:
4555
submodules: true
4656

57+
- name: Setup .NET
58+
uses: actions/setup-dotnet@v4
59+
with:
60+
dotnet-version: ${{ inputs.dotnet-version }}
61+
4762
# Install CKAN and set up an instance
48-
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
63+
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/setup-ckan@1.0.0-rc.1
4964
if: ${{ (inputs.use-ckan && inputs.use-msbuild) || inputs.dependency-identifiers }}
5065

5166
# Install any listed CKAN dependencies
52-
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
67+
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/install-dependencies@1.0.0-rc.1
5368
if: ${{ inputs.dependency-identifiers }}
5469
with:
5570
dependency-identifiers: ${{ inputs.dependency-identifiers }}
5671

5772
# Compile the mod
58-
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
73+
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/compile@1.0.0-rc.1
5974
if: ${{ inputs.use-msbuild }}
6075
with:
6176
build-configuration: ${{ inputs.build-configuration }}
6277
ksp-zip-url: ${{ inputs.ksp-zip-url }}
6378
ksp-zip-password: ${{ secrets.ksp-zip-password }}
6479
solution-file-path: ${{ inputs.solution-file-path }}
80+
use-nuget-restore: ${{ inputs.use-nuget-restore }}
6581

66-
# Assemble the mod into a release package and upload it as an artifact
67-
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected]
82+
# Assemble the mod into a release package
83+
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected]
84+
id: assemble-release
6885
with:
6986
artifacts: ${{ inputs.artifacts }}
70-
output-file-name: ${{ github.event.repository.name }}-${{ inputs.build-configuration }}
87+
output-file-name: ${{ github.event.repository.name }}
88+
89+
# Upload artifact
90+
- uses: actions/upload-artifact@v4
91+
id: upload-artifact
92+
with:
93+
path: ${{ steps.assemble-release.outputs.artifact-dir-path }}
94+
name: ${{ github.event.repository.name }}-${{ inputs.build-configuration }}
95+
if-no-files-found: error
96+
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`

.github/workflows/create-release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ jobs:
6464
submodules: true
6565

6666
- name: update-version
67-
uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
67+
uses: KSPModdingLibs/KSPBuildTools/.github/actions/update-version@1.0.0-rc.1
6868
with:
6969
version-string: ${{ inputs.version-string }}
7070
template-extension: ${{ inputs.version-template-extension }}
@@ -81,18 +81,18 @@ jobs:
8181
git tag -f -a "$VERSION_STRING" -m "$VERSION_STRING"
8282
8383
# Install CKAN and set up an instance
84-
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
84+
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/setup-ckan@1.0.0-rc.1
8585
if: ${{ (inputs.use-ckan && inputs.use-msbuild) || inputs.dependency-identifiers }}
8686

8787
# Install any listed CKAN dependencies
88-
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
88+
- uses: KSPModdingLibs/KSPBuildTools/.github/actions/install-dependencies@1.0.0-rc.1
8989
if: ${{ inputs.dependency-identifiers }}
9090
with:
9191
dependency-identifiers: ${{ inputs.dependency-identifiers }}
9292

9393
- name: compile
9494
if: ${{ inputs.use-msbuild }}
95-
uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
95+
uses: KSPModdingLibs/KSPBuildTools/.github/actions/compile@1.0.0-rc.1
9696
with:
9797
build-configuration: ${{ inputs.build-configuration }}
9898
ksp-zip-url: ${{ inputs.ksp-zip-url }}
@@ -101,7 +101,7 @@ jobs:
101101

102102
- name: assemble-release
103103
id: assemble-release
104-
uses: KSPModdingLibs/KSPBuildTools/.github/actions/[email protected].5
104+
uses: KSPModdingLibs/KSPBuildTools/.github/actions/assemble-release@1.0.0-rc.1
105105
with:
106106
artifacts: ${{ inputs.artifacts }}
107107
output-file-name: ${{ github.event.repository.name }}-${{ env.VERSION_STRING }}
@@ -111,4 +111,4 @@ jobs:
111111
GH_TOKEN: ${{ github.token }}
112112
run: |
113113
git push
114-
gh release create "$VERSION_STRING" --draft --target ${{ github.ref_name }} --title "$VERSION_STRING" "$ARTIFACT_FILENAME.zip" --notes-file "$RELEASE_NOTES_FILE"
114+
gh release create "$VERSION_STRING" --draft --target ${{ github.ref_name }} --title "$VERSION_STRING" "${{ steps.assemble-release.outputs.artifact-zip-path }}" --notes-file "$RELEASE_NOTES_FILE"

.github/workflows/internal-ci.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
env:
2020
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
2121
DOTNET_NOLOGO: true
22-
runs-on: ubuntu-22.04
22+
runs-on: ubuntu-24.04
2323
outputs:
2424
package-version: ${{ steps.get-version.outputs.version }}
2525
steps:
@@ -112,11 +112,18 @@ jobs:
112112
run: |
113113
dotnet nuget push --source "github" ${{ env.NuGetDirectory }}/*.nupkg
114114
115+
- name: Publish Package to Forgejo
116+
run: >
117+
dotnet nuget push ${{ env.NuGetDirectory }}/*.nupkg
118+
--api-key ${{ secrets.FORGEJO_DEPLOY_TOKEN }}
119+
--source https://git.offworldcolonies.nexus/api/packages/KSPModdingLibs/nuget/index.json
120+
115121
- name: Publish to Github Releases
116122
run: >
117123
gh release create ${{ github.ref_name }}
118124
--notes-file "${{ steps.yaclog-show.outputs.body-file }}"
119125
--title "${{ needs.build.outputs.package-version }}"
120126
${{ env.NuGetDirectory }}/*.nupkg
121127
env:
122-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
129+

.github/workflows/internal-test-assetbundle.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212

1313
jobs:
1414
build:
15-
runs-on: ubuntu-22.04
15+
runs-on: ubuntu-24.04
1616
steps:
1717
- uses: actions/checkout@v4
1818

.github/workflows/internal-test-plugin-legacy.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,29 @@ jobs:
1212
runs-on: ubuntu-22.04
1313
steps:
1414
- uses: actions/checkout@v4
15+
16+
- name: Setup .NET
17+
uses: actions/setup-dotnet@v4
18+
with:
19+
dotnet-version: '8.x'
1520

1621
- uses: ./.github/actions/setup-ckan
1722

1823
- uses: ./.github/actions/compile
1924
with:
2025
ksp-zip-url: https://github.com/KSPModdingLibs/KSPLibs/raw/main/KSP-1.12.5.zip
2126
working-directory: ${{ env.TESTDIR }}
27+
use-nuget-restore: true
2228

2329
- uses: ./.github/actions/assemble-release
30+
id: assemble-release
2431
with:
2532
artifacts: ${{ env.TESTDIR }}/GameData
2633
output-file-name: plugin-mod-legacy
34+
35+
- uses: actions/upload-artifact@v4
36+
with:
37+
path: ${{ steps.assemble-release.outputs.artifact-dir-path }}
38+
name: plugin-mod-legacy
39+
if-no-files-found: error
40+
include-hidden-files: 'true' # behavior changed in 4.4.0. Include hidden for matching the behavior of `zip`

0 commit comments

Comments
 (0)