Skip to content

Merge pull request #11 from jpw1991/10-upgrade-from-legacy-project-type #28

Merge pull request #11 from jpw1991/10-upgrade-from-legacy-project-type

Merge pull request #11 from jpw1991/10-upgrade-from-legacy-project-type #28

Workflow file for this run

name: build
permissions:
contents: write
on:
push:
branches:
- master
tags:
- build-*
env:
name: ChebsValheimLibrary
jsonf: manifest.json
bepinexdl: https://github.com/BepInEx/BepInEx/releases/download/v5.4.21/BepInEx_unix_5.4.21.0.zip
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
dotnet-version: [ '7.0.x' ]
steps:
- uses: actions/checkout@v3
- name: Setup .NET Core SDK ${{ matrix.dotnet-version }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ matrix.dotnet-version }}
- name: Get version
run: |
version="$(grep -o 'CurrentVersion = new(\"[.0-9]\+' ChebsValheimLibrary/Base.cs | cut -d '"' -f 2)"
echo "VERSION=${version}" >> $GITHUB_ENV
- name: Delete old Valheim directory
run: |
rm -rdf /home/runner/.local/share/Steam/steamapps/common/Valheim
- name: Download and install SteamCMD (64-bit)
run: |
mkdir steamcmd
cd steamcmd
wget https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xvzf steamcmd_linux.tar.gz
cd ..
- name: Install Valheim
run: |
./steamcmd/steamcmd.sh +force_install_dir /home/runner/.local/share/Steam/steamapps/common/Valheim +login anonymous +app_update 896660 validate +exit
- name: Install BepInEx
run: |
mv /home/runner/.local/share/Steam/steamapps/common/Valheim/valheim_server_Data/ /home/runner/.local/share/Steam/steamapps/common/Valheim/valheim_Data/
wget -O BepInEx.zip ${{ env.bepinexdl }}
unzip BepInEx.zip -d ~/BepInEx
mv ~/BepInEx/* /home/runner/.local/share/Steam/steamapps/common/Valheim/
- name: Replace paths inside csproj
run: |
sed -i -E "s/(\.\.\\\.\.\\\.\.\\\.local)/\\\\home\\\runner\\\.local/g" ${{env.name}}/${{env.name}}.csproj
sed -i -E "s/(\.\.\\\.\.\\\.\.\\\Downloads\\\BepInEx_unix_5\.4\.22\.0)/\\\\home\\\runner\\\.local\\\share\\\Steam\\\steamapps\\\common\\\Valheim/g" ${{env.name}}/${{env.name}}.csproj
- name: Install NuGet
uses: nuget/setup-nuget@v1
- name: Manual install Jotunn
run: |
echo "For some reason Jotunn via nuget won't work here, so manual install and link it. Remove this whenever possible"
wget https://github.com/Valheim-Modding/Jotunn/releases/download/v2.15.0/Jotunn.dll
mv Jotunn.dll /home/runner
refcontent='<Reference Include="Jotunn"><HintPath>\\home\\runner\\Jotunn.dll</HintPath></Reference>'
sed -i '/<Reference\sInclude="UnityEngine.PhysicsModule">/i\'"$refcontent" ${{env.name}}/${{env.name}}.csproj
- name: Confirm existence of critical files
run : |
for test in "BepInEx/core/BepInEx.dll" "valheim_Data/Managed/assembly_guiutils.dll" "valheim_Data/Managed/assembly_postprocessing.dll" "valheim_Data/Managed/assembly_utils.dll" "valheim_Data/Managed/assembly_valheim.dll" "valheim_Data/Managed/UnityEngine.dll" "valheim_Data/Managed/UnityEngine.AssetBundleModule.dll" "valheim_Data/Managed/UnityEngine.CoreModule.dll" "valheim_Data/Managed/UnityEngine.ParticleSystemModule.dll" "valheim_Data/Managed/UnityEngine.Physics2DModule.dll" "valheim_Data/Managed/UnityEngine.PhysicsModule.dll"; do
[ ! -f "/home/runner/.local/share/Steam/steamapps/common/Valheim/$test" ] && echo "$test not found!"
done
[ ! -f "/home/runner/Jotunn.dll" ] && echo "Jotunn.dll not found!"
cat ${{env.name}}/${{env.name}}.csproj
- name: Install dependencies
run: |
dotnet restore
nuget restore -SolutionDirectory ${{env.name}}/packages.config
dotnet tool restore
- name: Build
run: dotnet build --configuration Release --no-restore
- name: Package
run: |
[ ! -f "/publish_release.sh" ] && echo "publish_release.sh not found!"
./publish_release.sh ${{env.VERSION}}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: thunderstore-package-artifact
path: ${{ env.name }}/bin/Release/${{ env.name }}.${{ env.VERSION }}.zip
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ env.VERSION }}
body: ${{github.event.workflow_run.head_commit.message}}
files: |
Package/ChebsValheimLibrary.dll
README.md