docs: changelog #186
Workflow file for this run
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 Release | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PUSH_TO_PROTECTED_BRANCH }} | |
ref: 'dev' | |
- 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 | |
- name: Get the version | |
id: get_version | |
run: | | |
echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT | |
echo "VERSION_NUMBER=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_OUTPUT | |
- name: Setup .NET 8 | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.x' | |
- name: Restore project dependencies | |
run: dotnet restore JotunnLib/JotunnLib.csproj | |
- name: Restore tools | |
run: | | |
dotnet tool restore | |
- 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 | |
- 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 publicized dlls from cache | |
if: steps.cachevalheim.outputs.cache-hit != 'true' | |
run: | | |
rm -rf ~/VHINSTALL/valheim_Data/Managed/publicized_assemblies | |
rm -rf ~/VHINSTALL/valheim_server_Data/Managed/publicized_assemblies | |
- name: Create Environment.props | |
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 | |
- name: Create 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 | |
- name: Create version.props | |
run: | | |
echo "<?xml version=\"1.0\" encoding=\"utf-8\"?><Project ToolsVersion=\"Current\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\"><PropertyGroup><Version>${{ steps.get_version.outputs.VERSION_NUMBER }}</Version></PropertyGroup></Project>" > JotunnLib/BuildProps/version.props | |
- name: Update GitVersion.yml version | |
run: | | |
cat JotunnLib/GitVersion.yml | sed '4s/.*/next-version: ${{ steps.get_version.outputs.VERSION_NUMBER }}/' > JotunnLib/GitVersion_temp.yml && mv JotunnLib/GitVersion_temp.yml JotunnLib/GitVersion.yml | |
- name: Update manifest.json version | |
run: | | |
cat JotunnLib/manifest.json | sed -e 's/version_number": "[^"]*"/version_number": "${{ steps.get_version.outputs.VERSION_NUMBER }}"/' > JotunnLib/manifest.tmp && mv JotunnLib/manifest.tmp JotunnLib/manifest.json | |
- name: Update Main.cs version | |
run: | | |
cat JotunnLib/Main.cs | sed -e 's/public const string Version = ".*";/public const string Version = "${{ steps.get_version.outputs.VERSION_NUMBER }}";/' > JotunnLib/Main.tmp && mv JotunnLib/Main.tmp JotunnLib/Main.cs | |
cat JotunnLib/Main.cs | sed -e 's/-.*";/";/' > JotunnLib/Main.tmp && mv JotunnLib/Main.tmp JotunnLib/Main.cs | |
- name: Push version update to prod | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git add JotunnLib/GitVersion.yml | |
git add JotunnLib/BuildProps/version.props | |
git add JotunnLib/manifest.json | |
git add JotunnLib/Main.cs | |
git commit -m "deploy: Released ${{ steps.get_version.outputs.VERSION }}" | |
git push https://${{ secrets.PUSH_TO_PROTECTED_BRANCH }}@github.com/${{ github.repository }} HEAD:dev | |
git push https://${{ secrets.PUSH_TO_PROTECTED_BRANCH }}@github.com/${{ github.repository }} dev:prod | |
- name: Build solution | |
run: | | |
dotnet build JotunnLib.sln --configuration Release | |
mv JotunnLib/bin/Release/net462/Jotunn.dll Jotunn.dll | |
dotnet build JotunnLib.sln --configuration Debug | |
mv JotunnLib/bin/Debug/net462/Jotunn.dll Jotunn-DEBUG-${{ steps.get_version.outputs.VERSION }}.dll | |
- name: Upload Nexusmods zip as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Jotunn-${{ steps.get_version.outputs.VERSION }}-Nexusmods.zip | |
path: JotunnLib/_package/Nexusmods/Jotunn-${{ steps.get_version.outputs.VERSION }}.zip | |
- name: Upload Thunderstore zip as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Jotunn-${{ steps.get_version.outputs.VERSION }}-Thunderstore.zip | |
path: JotunnLib/_package/Thunderstore/Jotunn-${{ steps.get_version.outputs.VERSION }}.zip | |
- name: Publish to NuGet | |
run: | | |
dotnet nuget push "JotunnLib/bin/Debug/*.nupkg" -k ${{ secrets.NUGET_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate | |
- name: Create GH Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
Jotunn.dll | |
Jotunn-DEBUG-${{ steps.get_version.outputs.VERSION }}.dll | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# - name: Read unex.yml | |
# id: unexyaml | |
# uses: juliojimenez/yamler@v0 | |
# with: | |
# yaml-file: unex.yml | |
# | |
# - name: Create output vars from unex.yml | |
# id: unexconf | |
# run: | | |
# echo "modid=${{ steps.unexyaml.outputs.modid }}" >> $GITHUB_OUTPUT | |
# | |
# - name: Upload to NexusMods | |
# run: > | |
# dotnet unex upload | |
# ${{ steps.unexconf.outputs.modid }} | |
# JotunnLib/_packages/ | |
# -v ${{ steps.get_version.outputs.VERSION_NUMBER }} | |
# | |
# env: | |
# UNEX_DEBUG: true | |
# UNEX_APIKEY: ${{ secrets.UNEX_API_KEY }} | |
# UNEX_COOKIES: ${{ secrets.UNEX_COOKIES }} |