-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/dev' into dev
- Loading branch information
Showing
5 changed files
with
98 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Publish NuGet Package | ||
|
||
on: | ||
release: | ||
types: [ "published" ] | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v3 | ||
|
||
- 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 "SpaceWarp.sln" -c Release | ||
|
||
- name: Extract current version | ||
id: get-version | ||
run: | | ||
version=$(jq -r '.version' plugin_template/BepInEx/plugins/SpaceWarp/swinfo.json) | ||
echo "Version is $version" | ||
echo "::set-output name=version::$version" | ||
- name: Check if version exists | ||
id: check-version | ||
run: | | ||
version=${{ steps.get-version.outputs.version }} | ||
response=$(curl -s "https://nuget.spacewarp.org/v3/search?q=SpaceWarp") | ||
exists=$(echo "$response" | jq -r --arg id "SpaceWarp" --arg version "$version" '.data[] | select(.id == $id) | .versions[] | select(.version == $version) | .version') | ||
if [ "$exists" == "$version" ]; then | ||
echo "Version $version already exists in the NuGet repository" | ||
exit 1 | ||
else | ||
echo "Version $version does not exist in the NuGet repository" | ||
echo "::set-output name=should_publish::true" | ||
fi | ||
- name: Publish NuGet package | ||
if: steps.check-version.outputs.should_publish == 'true' | ||
run: | | ||
nupkg_path=$(ls -1 nuget/SpaceWarp.*.nupkg | head -n 1) | ||
dotnet nuget push "$nupkg_path" -s https://nuget.spacewarp.org/v3/index.json -k ${{ secrets.NUGET_SERVER_KEY }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters