Skip to content

Commit

Permalink
Merge pull request #29 from Safarte/dev
Browse files Browse the repository at this point in the history
Fix issue with science labs not loading in OAB
  • Loading branch information
Safarte authored Jan 6, 2024
2 parents 05fc0e3 + 1a65a94 commit ebd4ef2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 43 deletions.
66 changes: 25 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
name: Upload release
env:
MOD_ID: 3485
KSP2_ID: 22407
name: Publish NuGet and upload release

on:
release:
Expand All @@ -12,64 +9,51 @@ jobs:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout repository
- name: Check out repository
uses: actions/checkout@v4

- name: Install jq
uses: dcarbone/[email protected]

- name: Download NuGet
id: download-nuget
run: |
sudo curl -o /usr/local/bin/nuget.exe https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
- name: Install jq
uses: dcarbone/[email protected]

- name: Build the solution
run: dotnet build "KerbalLifeSupportSystem.sln" -c Release

- name: Extract current version
id: get-version
run: |
version=$(jq -r '.version' plugin_template/swinfo.json)
echo "Version is $version"
echo "version=$version" >> $GITHUB_ENV
dotnet build "KerbalLifeSupportSystem.sln" -c Release
echo "release_filename=KerbalLifeSupportSystem-$version.zip" >> $GITHUB_ENV
echo "artifact_name=KerbalLifeSupportSystem-$version.zip" >> $GITHUB_ENV
echo "zip=$(ls -1 dist/KerbalLifeSupportSystem-*.zip | head -n 1)" >> $GITHUB_ENV
echo "upload_url=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].upload_url' | tr -d \")" >> $GITHUB_ENV
echo "changelog=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].body' | tr -d \")" >> $GITHUB_ENV
echo "${{ env.changelog }}" > ./changelog.md
wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[0].body' > ./changelog.md
- name: Upload zip to release
- name: Upload Zip
uses: shogo82148/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.upload_url }}
asset_path: ${{ env.zip }}
asset_name: ${{ env.release_filename }}
asset_name: ${{ env.artifact_name }}
asset_content_type: application/zip

- name: Add Mask
run: echo "::add-mask::${{ secrets.SPACEDOCK_PASSWORD }}"

- name: Log in to spacedock
run: |
login_response=$(curl -F username=${{ secrets.SPACEDOCK_USER }} -F password=${{ secrets.SPACEDOCK_PASSWORD }} -c ./cookies "https://spacedock.info/api/login")
login_errored=$(echo $login_response | jq .error)
if [ "$login_errored" == "true" ]; then
echo "Login to space dock errored: $(echo $login_response | jq .reason)"
exit 1
else
echo "Login to space dock successful"
fi
- name: Query latest game version
run: |
echo "LATEST_GAME_VERSION=$(curl 'https://spacedock.info/api/${{ env.KSP2_ID }}/versions' | jq '.[0].friendly_version' | tr -d \")" >> $GITHUB_ENV
- name: Update mod on spacedock
run: |
result=$(curl -b ./cookies -F "version=${{ env.version }}" -F "changelog=@./changelog.md" -F "game-version=${{ env.LATEST_GAME_VERSION }}" -F "notify-followers=yes" -F "zipball=@${{ env.zip }}" "https://spacedock.info/api/mod/${{ env.MOD_ID }}/update")
errored=$(echo $result | jq .error)
if [ "$errored" == "true" ]; then
echo "Upload to space dock errored: $(echo $result | jq .reason)"
exit 1
else
echo "Upload to space dock successful"
fi

- name: Update spacedock
uses: KSP2Community/[email protected]
with:
username: ${{ secrets.SPACEDOCK_USER }}
password: ${{ secrets.SPACEDOCK_PASSWORD }}
game_id: 22407
mod_id: 3485
version: ${{ env.version }}
zipball: ${{ env.zip }}
changelog: ./changelog.md
2 changes: 1 addition & 1 deletion plugin_template/patches/add_LS_resources.patch
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
}
}

:parts ~#eva_kerbal ~.Module_ResourceCapacities {
:parts ~#eva_kerbal ~#lab_2v_science_orbital ~#lab_2v_science_marine ~.Module_ResourceCapacities {
@if $$crewCapacity > 0 {
+Module_ResourceCapacities {
+Data_ResourceCapacities {}
Expand Down
2 changes: 1 addition & 1 deletion plugin_template/swinfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Kerbal Life-Support System",
"description": "Kerbals need their Snacks.",
"source": "https://github.com/Safarte/KerbalLifeSupportSystem",
"version": "0.5.3",
"version": "0.5.4",
"version_check": "https://raw.githubusercontent.com/Safarte/KerbalLifeSupportSystem/main/plugin_template/swinfo.json",
"ksp2_version": {
"min": "0.2.0",
Expand Down

0 comments on commit ebd4ef2

Please sign in to comment.