From 3f4e0f5e348662e30312fe3a87d4c34434a0c1d5 Mon Sep 17 00:00:00 2001 From: cheese3660 Date: Wed, 3 Jan 2024 13:17:46 -0500 Subject: [PATCH 1/6] Update on-release.yml --- .github/workflows/on-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index d828f3c..1e82efb 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -36,6 +36,7 @@ jobs: echo "zip=$(ls -1 dist/PatchManager-*.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 \" | jq -Rr @uri)" >> $GITHUB_ENV + echo "${{ env.changelog }}" > ./changelog.md - name: Check if version exists id: check-version @@ -86,7 +87,7 @@ jobs: - name: Update mod on spacedock run: | - 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") + 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)" From 80afe97924721f6e606e4a31c872e84990ebd3c2 Mon Sep 17 00:00:00 2001 From: cheese3660 Date: Fri, 5 Jan 2024 11:57:45 -0500 Subject: [PATCH 2/6] Remove uri encoding as we are going to splat the file using curl --- .github/workflows/on-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 1e82efb..59b1e71 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -35,7 +35,7 @@ jobs: echo "artifact_name=PatchManager-$version.zip" >> $GITHUB_ENV echo "zip=$(ls -1 dist/PatchManager-*.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 \" | jq -Rr @uri)" >> $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 - name: Check if version exists From a0ef08e80382e681766c1de48bad4526aa1582b8 Mon Sep 17 00:00:00 2001 From: Lexi Date: Sat, 6 Jan 2024 08:45:00 -0500 Subject: [PATCH 3/6] Fix recipe selectables --- src/PatchManager.Resources/Rulesets/ResourceRuleset.cs | 7 ++----- src/PatchManager.Resources/Selectables/RecipeSelectable.cs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/PatchManager.Resources/Rulesets/ResourceRuleset.cs b/src/PatchManager.Resources/Rulesets/ResourceRuleset.cs index a4f3bc1..c3918a7 100644 --- a/src/PatchManager.Resources/Rulesets/ResourceRuleset.cs +++ b/src/PatchManager.Resources/Rulesets/ResourceRuleset.cs @@ -20,14 +20,11 @@ public class ResourceRuleset : IPatcherRuleSet public ISelectable ConvertToSelectable(string type, string name, string jsonData) { var obj = JObject.Parse(jsonData); - if (obj.ContainsKey("isRecipe") && obj["isRecipe"].Value()) + if (obj.ContainsKey("isRecipe") && obj["isRecipe"]!.Value()) { return new RecipeSelectable(jsonData); } - else - { - return new ResourceSelectable(jsonData); - } + return new ResourceSelectable(jsonData); } /// diff --git a/src/PatchManager.Resources/Selectables/RecipeSelectable.cs b/src/PatchManager.Resources/Selectables/RecipeSelectable.cs index c572698..2a3d3e9 100644 --- a/src/PatchManager.Resources/Selectables/RecipeSelectable.cs +++ b/src/PatchManager.Resources/Selectables/RecipeSelectable.cs @@ -92,7 +92,7 @@ public override bool MatchesClass(string @class, out DataValue classValue) public override bool IsSameAs(ISelectable other) => other is RecipeSelectable rs && rs.Name == Name; /// - public override IModifiable OpenModification() => new JTokenModifiable(JObject["data"], SetModified); + public override IModifiable OpenModification() => new JTokenModifiable(JObject["recipeData"], SetModified); /// public override ISelectable AddElement(string elementType) From de93119aa8c5a577a306cc5d1b589313d3626376 Mon Sep 17 00:00:00 2001 From: cheese3660 Date: Sat, 6 Jan 2024 09:12:26 -0500 Subject: [PATCH 4/6] Update on-release.yml to unescape the json --- .github/workflows/on-release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index 59b1e71..e6e69be 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -35,7 +35,7 @@ jobs: echo "artifact_name=PatchManager-$version.zip" >> $GITHUB_ENV echo "zip=$(ls -1 dist/PatchManager-*.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 "changelog=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[0].body')" >> $GITHUB_ENV echo "${{ env.changelog }}" > ./changelog.md - name: Check if version exists From 26c6dbb950451472bc1d963bd95ebf1b2ff23b17 Mon Sep 17 00:00:00 2001 From: cheese3660 Date: Sat, 6 Jan 2024 09:34:46 -0500 Subject: [PATCH 5/6] Update on-release.yml --- .github/workflows/on-release.yml | 40 ++++++++------------------------ 1 file changed, 10 insertions(+), 30 deletions(-) diff --git a/.github/workflows/on-release.yml b/.github/workflows/on-release.yml index e6e69be..bba0462 100644 --- a/.github/workflows/on-release.yml +++ b/.github/workflows/on-release.yml @@ -1,8 +1,5 @@ name: Publish NuGet and upload release -env: - MOD_ID: 3482 - KSP2_ID: 22407 - + on: release: types: [ "published" ] @@ -70,29 +67,12 @@ jobs: - 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/spacedock-upload@v1.0.0 + with: + username: ${{ secrets.SPACEDOCK_USER }} + password: ${{ secrets.SPACEDOCK_PASSWORD }} + game_id: 22407 + mod_id: 3482 + version: ${{ env.version }} + changelog: ./changelog.md From 6bad32de2437fa3291403e999ecf7c28ee892a1e Mon Sep 17 00:00:00 2001 From: cheese3660 Date: Sat, 6 Jan 2024 09:35:31 -0500 Subject: [PATCH 6/6] Update swinfo.json --- plugin_template/swinfo.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugin_template/swinfo.json b/plugin_template/swinfo.json index 563a2e1..64ca3f7 100644 --- a/plugin_template/swinfo.json +++ b/plugin_template/swinfo.json @@ -5,7 +5,7 @@ "name": "Patch Manager", "description": "A mod for generic patching needs similar to KSP 1's Module Manager.", "source": "https://github.com/KSP2Community/PatchManager", - "version": "0.9.0", + "version": "0.9.1", "version_check": "https://raw.githubusercontent.com/KSP2Community/PatchManager/main/plugin_template/swinfo.json", "ksp2_version": { "min": "0.2.0",