Skip to content

Commit

Permalink
Release action SpaceDock integration
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-bures committed Jan 22, 2024
1 parent 382396c commit 1ffbef0
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
name: Upload release

env:
SPACEDOCK_MOD_ID: 3534

on:
release:
types: [ "published" ]
Expand All @@ -11,18 +14,29 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true

- 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/install-jq-action@v2.1.0

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

- name: Extract current version
id: get-version
run: |
version=$(jq -r '.version' plugin_template/swinfo.json)
echo "Version is $version"
dotnet build "KerbalLifeHacks.sln" -c Release
echo "version=$version" >> $GITHUB_ENV
echo "release_filename=KerbalLifeHacks-$version.zip" >> $GITHUB_ENV
echo "zip=$(ls -1 dist/KerbalLifeHacks-*.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
wget -qO- https://api.github.com/repos/$GITHUB_REPOSITORY/releases | jq -r '.[0].body' > ./changelog.md
- name: Upload zip to release
uses: shogo82148/actions-upload-release-asset@v1.7.2
Expand All @@ -34,3 +48,16 @@ jobs:
asset_name: ${{ env.release_filename }}
asset_content_type: application/zip

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

- name: Update mod on SpaceDock
uses: KSP2Community/spacedock-upload@v1.0.0
with:
username: ${{ secrets.SPACEDOCK_USER }}
password: ${{ secrets.SPACEDOCK_PASSWORD }}
game_id: 22407
mod_id: ${{ env.SPACEDOCK_MOD_ID }}
version: ${{ env.version }}
zipball: ${{ env.zip }}
changelog: ./changelog.md

0 comments on commit 1ffbef0

Please sign in to comment.