Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
cheese3660 committed Dec 27, 2023
2 parents ac9c82b + 93db4ee commit ce7a7e9
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Upload release

on:
release:
types: [ "published" ]

jobs:
publish:
runs-on: ubuntu-latest
permissions: write-all
steps:
- 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: Build the solution
run: dotnet build "WMCCModules.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
echo "artifact_name=WMCCModules-$version.zip" >> $GITHUB_ENV
echo "zip=$(ls -1 dist/WMCCModules-*.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
- 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.artifact_name }}
asset_content_type: application/zip
8 changes: 6 additions & 2 deletions src/WMCCModules/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<PowershellExecutable Condition="'$(OS)' == 'Windows_NT'">powershell</PowershellExecutable>
<PowershellExecutable Condition="'$(OS)' != 'Windows_NT'">pwsh</PowershellExecutable>
</PropertyGroup>
<Target Label="Post build events" Name="PostBuild" AfterTargets="PostBuildEvent">
<Message Text="Cleaning up previous build directory"/>
<RemoveDir Directories="$(SolutionDir)/dist/$(ConfigurationName)"/>
Expand Down Expand Up @@ -34,7 +38,7 @@
<Delete Condition="$(ConfigurationName) == Release"
Files="$(SolutionDir)/dist/$(SolutionName)-$(Version).zip"/>
<Exec Condition="$(ConfigurationName) == Release"
Command="powershell Compress-Archive -Path '$(SolutionDir)/dist/$(ConfigurationName)/BepInEx' -DestinationPath '$(SolutionDir)/dist/$(SolutionName)-$(Version).zip'"/>
Command="$(PowerShellExecutable) -Command &quot;&amp; {Push-Location '$(SolutionDir)/dist/$(ConfigurationName)'; Compress-Archive -Path './*' -DestinationPath '$(SolutionDir)/dist/$(SolutionName)-$(Version).zip'; Pop-Location}&quot;"/>

<Message Text="Clean up the game's plugin folder" Condition="$(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"/>
<RemoveDir Condition="$(ConfigurationName) == Deploy Or $(ConfigurationName) == DeployAndRun"
Expand All @@ -52,7 +56,7 @@
DestinationFolder="$(KSP2DIR)/BepInEx/plugins/$(ProjectName)/%(RecursiveDir)"/>

<Message Text="Deploy plugin and run game" Condition="$(ConfigurationName) == DeployAndRun"/>
<Exec Command="powershell &quot;start-process &quot;&quot;$(KSP2DIR)\KSP2_x64.exe&quot;&quot;&quot;" Condition="$(ConfigurationName) == DeployAndRun"/>
<Exec Command="$(PowerShellExecutable) &quot;start-process &quot;&quot;$(KSP2DIR)\KSP2_x64.exe&quot;&quot;&quot;" Condition="$(ConfigurationName) == DeployAndRun"/>
</Target>
</Project>

0 comments on commit ce7a7e9

Please sign in to comment.