deploy: Released v2.19.1 #1078
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
name: Create DLL on merge to dev | |
on: | |
push: | |
branches: | |
- dev | |
paths-ignore: | |
- 'JotunnLib/Documentation/**' | |
jobs: | |
build_merge: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
# Get date | |
- name: Get current date | |
id: date | |
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
# Get Valheim version id | |
- name: Get Valheim version id | |
id: valheimversion | |
run: echo "valheimversion=$(curl -s https://api.steamcmd.net/v1/info/896660 | jq -r ".data.\"896660\".depots.branches.public.buildid")" >> $GITHUB_OUTPUT | |
# Install NuGet | |
- uses: nuget/setup-nuget@v1 | |
name: Install NuGet | |
# Install NuGet dependencies | |
- name: Install NuGet dependencies | |
run: | | |
nuget restore JotunnLib.sln | |
dotnet restore JotunnLib/JotunnLib.csproj | |
# Get build commands | |
- name: Get build commands | |
run: | | |
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF | |
echo "deb https://download.mono-project.com/repo/ubuntu stable-focal main" | sudo tee /etc/apt/sources.list.d/mono-official-stable.list | |
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb | |
sudo dpkg -i packages-microsoft-prod.deb | |
sudo apt-get update | |
sudo apt-get install -y mono-roslyn mono-complete mono-dbg msbuild unzip dirmngr dotnet-sdk-5.0 dotnet-runtime-5.0 | |
# Cache the results | |
- name: Cache Valheim | |
id: cachevalheim | |
uses: actions/cache@v3 | |
with: | |
path: ~/VHINSTALL | |
key: ${{ steps.valheimversion.outputs.valheimversion }}-${{ hashFiles('**/lockfiles') }}-BepInExPack-5.4.2202 | |
- name: Install SteamCMD | |
if: steps.cachevalheim.outputs.cache-hit != 'true' | |
uses: CyberAndrii/setup-steamcmd@v1 | |
# Prepare Valheim dependencies | |
- name: Prepare Valheim dependencies | |
if: steps.cachevalheim.outputs.cache-hit != 'true' | |
run: | | |
wget -O bepinex.zip "https://thunderstore.io/package/download/denikson/BepInExPack_Valheim/5.4.2202/" | |
unzip bepinex.zip -d ~/BepInExRaw | |
steamcmd +force_install_dir ~/VHINSTALL +login anonymous +app_update 896660 validate +exit | |
mv ~/VHINSTALL/valheim_server_Data/ ~/VHINSTALL/valheim_Data/ | |
mv ~/BepInExRaw/BepInExPack_Valheim/* ~/VHINSTALL/ | |
- name: remove old hash, publicized dlls and mmhook dlls | |
run: | | |
rm -rf ~/VHINSTALL/valheim_server_Data/Managed/publicized_assemblies | |
rm -rf ~/VHINSTALL/BepInEx/plugins/MMHOOK | |
- name: Set references to DLLs | |
run: | | |
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"><PropertyGroup><VALHEIM_INSTALL>$HOME/VHINSTALL/</VALHEIM_INSTALL></PropertyGroup></Project>" > Environment.props | |
# Gitversion | |
- name: Install GitVersion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
versionSpec: "5.x" | |
- name: Determine Version | |
id: gitversion | |
uses: gittools/actions/gitversion/[email protected] | |
with: | |
useConfigFile: true | |
configFilePath: JotunnLib/GitVersion.yml | |
- name: Set JotunnLib version | |
run: | | |
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"><PropertyGroup><Version>${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.patch }}-${{ steps.gitversion.outputs.commitsSinceVersionSource }}</Version></PropertyGroup></Project>" > JotunnLib/BuildProps/version.props | |
- name: Update Main.cs version | |
run: | | |
cat JotunnLib/Main.cs | sed -e 's/public const string Version = ".*";/public const string Version = "${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.patch }}";/' > JotunnLib/Main.tmp && mv JotunnLib/Main.tmp JotunnLib/Main.cs | |
- name: Reset DoPrebuild.props | |
run: | | |
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"><PropertyGroup><ExecutePrebuild>true</ExecutePrebuild></PropertyGroup></Project>" > JotunnLib/BuildProps/DoPrebuild.props | |
# Build DLLs | |
- name: Build solution | |
run: | | |
msbuild JotunnLib.sln /p:Configuration=Release | |
# Upload artifact | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Jotunn-${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.patch }}-${{ steps.gitversion.outputs.commitsSinceVersionSource }}.dll | |
path: JotunnLib/bin/Release/net462/Jotunn.dll | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: JotunnLib.${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.patch }}-${{ steps.gitversion.outputs.commitsSinceVersionSource }}.nupkg | |
path: JotunnLib/bin/Release/JotunnLib.${{ steps.gitversion.outputs.major }}.${{ steps.gitversion.outputs.minor }}.${{ steps.gitversion.outputs.patch }}-${{ steps.gitversion.outputs.commitsSinceVersionSource }}.nupkg |