Skip to content

Commit 5e9a3e7

Browse files
authored
Merge pull request #30 from KSP2Community/dev
0.8.1 Hotfix
2 parents 16f6538 + 6bad32d commit 5e9a3e7

File tree

4 files changed

+16
-38
lines changed

4 files changed

+16
-38
lines changed

.github/workflows/on-release.yml

Lines changed: 12 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
name: Publish NuGet and upload release
2-
env:
3-
MOD_ID: 3482
4-
KSP2_ID: 22407
5-
2+
63
on:
74
release:
85
types: [ "published" ]
@@ -35,7 +32,8 @@ jobs:
3532
echo "artifact_name=PatchManager-$version.zip" >> $GITHUB_ENV
3633
echo "zip=$(ls -1 dist/PatchManager-*.zip | head -n 1)" >> $GITHUB_ENV
3734
echo "upload_url=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].upload_url' | tr -d \")" >> $GITHUB_ENV
38-
echo "changelog=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].body' | tr -d \" | jq -Rr @uri)" >> $GITHUB_ENV
35+
echo "changelog=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[0].body')" >> $GITHUB_ENV
36+
echo "${{ env.changelog }}" > ./changelog.md
3937
4038
- name: Check if version exists
4139
id: check-version
@@ -69,29 +67,12 @@ jobs:
6967
- name: Add Mask
7068
run: echo "::add-mask::${{ secrets.SPACEDOCK_PASSWORD }}"
7169

72-
- name: Log in to spacedock
73-
run: |
74-
login_response=$(curl -F username=${{ secrets.SPACEDOCK_USER }} -F password=${{ secrets.SPACEDOCK_PASSWORD }} -c ./cookies "https://spacedock.info/api/login")
75-
login_errored=$(echo $login_response | jq .error)
76-
if [ "$login_errored" == "true" ]; then
77-
echo "Login to space dock errored: $(echo $login_response | jq .reason)"
78-
exit 1
79-
else
80-
echo "Login to space dock successful"
81-
fi
82-
83-
- name: Query latest game version
84-
run: |
85-
echo "LATEST_GAME_VERSION=$(curl 'https://spacedock.info/api/${{ env.KSP2_ID }}/versions' | jq '.[0].friendly_version' | tr -d \")" >> $GITHUB_ENV
86-
87-
- name: Update mod on spacedock
88-
run: |
89-
result=$(curl -b ./cookies -F "version=${{ env.version }}" -F "changelog=${{ env.changelog }}" -F "game-version=${{ env.LATEST_GAME_VERSION }}" -F "notify-followers=yes" -F "zipball=@${{ env.zip }}" "https://spacedock.info/api/mod/${{ env.MOD_ID }}/update")
90-
errored=$(echo $result | jq .error)
91-
if [ "$errored" == "true" ]; then
92-
echo "Upload to space dock errored: $(echo $result | jq .reason)"
93-
exit 1
94-
else
95-
echo "Upload to space dock successful"
96-
fi
97-
70+
- name: Update spacedock
71+
uses: KSP2Community/[email protected]
72+
with:
73+
username: ${{ secrets.SPACEDOCK_USER }}
74+
password: ${{ secrets.SPACEDOCK_PASSWORD }}
75+
game_id: 22407
76+
mod_id: 3482
77+
version: ${{ env.version }}
78+
changelog: ./changelog.md

plugin_template/swinfo.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"name": "Patch Manager",
66
"description": "A mod for generic patching needs similar to KSP 1's Module Manager.",
77
"source": "https://github.com/KSP2Community/PatchManager",
8-
"version": "0.9.0",
8+
"version": "0.9.1",
99
"version_check": "https://raw.githubusercontent.com/KSP2Community/PatchManager/main/plugin_template/swinfo.json",
1010
"ksp2_version": {
1111
"min": "0.2.0",

src/PatchManager.Resources/Rulesets/ResourceRuleset.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,11 @@ public class ResourceRuleset : IPatcherRuleSet
2020
public ISelectable ConvertToSelectable(string type, string name, string jsonData)
2121
{
2222
var obj = JObject.Parse(jsonData);
23-
if (obj.ContainsKey("isRecipe") && obj["isRecipe"].Value<bool>())
23+
if (obj.ContainsKey("isRecipe") && obj["isRecipe"]!.Value<bool>())
2424
{
2525
return new RecipeSelectable(jsonData);
2626
}
27-
else
28-
{
29-
return new ResourceSelectable(jsonData);
30-
}
27+
return new ResourceSelectable(jsonData);
3128
}
3229

3330
/// <inheritdoc />

src/PatchManager.Resources/Selectables/RecipeSelectable.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ public override bool MatchesClass(string @class, out DataValue classValue)
9292
public override bool IsSameAs(ISelectable other) => other is RecipeSelectable rs && rs.Name == Name;
9393

9494
/// <inheritdoc />
95-
public override IModifiable OpenModification() => new JTokenModifiable(JObject["data"], SetModified);
95+
public override IModifiable OpenModification() => new JTokenModifiable(JObject["recipeData"], SetModified);
9696

9797
/// <inheritdoc />
9898
public override ISelectable AddElement(string elementType)

0 commit comments

Comments
 (0)