Skip to content

Update build.yml

Update build.yml #12

Workflow file for this run

name: Build
on:
push:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- 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 "Premonition.sln" -c Release
- name: Run tests
id: run-tests
run: |
pushd ./build/bin/tests/Release/PremonitionPreTester/Release/net6.0/
result=$(./PremonitionPreTester)
popd
if [ "$result" == "0" ] then
echo "Tests ran successfully"
else
echo "Tests failed"
exit 1
fi
- name: Find zip
id: find-zip
run: |
echo "zip_bie=$(ls -1 dist/Premonition-BepInEx-*.zip | head -n 1)" >> $GITHUB_ENV
echo "artifact_name_bie=PremonitionBepInEx" >> $GITHUB_ENV
echo "zip_sw=$(ls -1 dist/Premonition-SpaceWarp-*.zip | head -n 1)" >> $GITHUB_ENV
echo "artifact_name_sw=PremonitionSpaceWarp" >> $GITHUB_ENV
- name: Upload BepInEx zip artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name_bie }}
path: ${{ env.zip_bie }}
- name: Upload SpaceWarp zip artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name_sw }}
path: ${{ env.zip_sw }}
- name: Find NuGet package
id: find-nupkg
run: |
echo "nupkg=$(ls -1 nuget/Premonition.Core.*.nupkg | head -n 1)" >> $GITHUB_ENV
echo "artifact_name=Premonition.Core" >> $GITHUB_ENV
- name: Upload NuGet package
uses: actions/upload-artifact@v3
with:
name: ${{ env.artifact_name }}
path: ${{ env.nupkg }}