Skip to content

Commit 1240cdb

Browse files
authored
Update on-release.yml
1 parent 4a7cd46 commit 1240cdb

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

.github/workflows/on-release.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Publish NuGet and upload release
22
env:
33
MOD_ID: 3482
4-
LATEST_GAME_VERSION: 0.2.0
4+
LATEST_GAME_VERSION: 0.2.0.0
55

66
on:
77
release:
@@ -35,7 +35,7 @@ jobs:
3535
echo "artifact_name=PatchManager-$version.zip" >> $GITHUB_ENV
3636
echo "zip=$(ls -1 dist/PatchManager-*.zip | head -n 1)" >> $GITHUB_ENV
3737
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 \")" >> $GITHUB_ENV
38+
echo "changelog=$(wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq '.[0].body' | tr -d \" | sed 's/@/%40/g')" >> $GITHUB_ENV
3939
4040
- name: Check if version exists
4141
id: check-version
@@ -45,7 +45,6 @@ jobs:
4545
exists=$(echo "$response" | jq -r --arg id "PatchManager" --arg version "$version" '.data[] | select(.id == $id) | .versions[] | select(.version == $version) | .version')
4646
if [ "$exists" == "$version" ]; then
4747
echo "Version $version already exists in the NuGet repository"
48-
exit 1
4948
else
5049
echo "Version $version does not exist in the NuGet repository"
5150
echo "should_publish=true" >> $GITHUB_ENV
@@ -66,12 +65,15 @@ jobs:
6665
asset_path: ${{ env.zip }}
6766
asset_name: ${{ env.artifact_name }}
6867
asset_content_type: application/zip
69-
68+
69+
- name: Add Mask
70+
run: echo "::add-mask::${{ secrets.SPACEDOCK_PASSWORD }}"
71+
7072
- name: Log in to spacedock
7173
run: |
7274
login_response=$(curl -F username=${{ secrets.SPACEDOCK_USER }} -F password=${{ secrets.SPACEDOCK_PASSWORD }} -c ./cookies "https://spacedock.info/api/login")
7375
login_errored=$(echo $login_response | jq .error)
74-
if [ "$login_errored" = "true" ]; then
76+
if [ "$login_errored" == "true" ]; then
7577
echo "Login to space dock errored: $(echo $login_response | jq .reason)"
7678
exit 1
7779
else
@@ -80,5 +82,12 @@ jobs:
8082
8183
- name: Update mod on spacedock
8284
run: |
83-
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"
85+
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")
86+
errored=$(echo $result | jq .error)
87+
if [ "$errored" == "true" ]; then
88+
echo "Upload to space dock errored: $(echo $result | jq .reason)"
89+
exit 1
90+
else
91+
echo "Upload to space dock successful"
92+
fi
8493

0 commit comments

Comments
 (0)