2022-01-12 22:47:04 +01:00
name : Build
on :
2022-01-17 13:15:48 +01:00
push :
tags :
2022-09-01 01:17:23 +02:00
- 'v*'
2022-04-19 03:21:18 +02:00
workflow_dispatch :
inputs :
job :
description : 'Job to run'
required : true
default : 'build-thunderstore-package'
2022-01-12 22:47:04 +01:00
env :
2022-02-02 00:07:37 +01:00
NORTHSTAR_VERSION : ${{ github.ref_name }}
2022-01-12 22:47:04 +01:00
jobs :
build-launcher :
runs-on : windows-2022
steps :
2022-03-13 20:59:21 +01:00
- name : Setup bundled plugins
uses : actions/checkout@v2
with :
repository : R2Northstar/NorthstarDiscordRPC
path : discord-plugin
- name : Checkout launcher repository
2022-01-12 22:47:04 +01:00
uses : actions/checkout@v2
with :
repository : R2Northstar/NorthstarLauncher
ref : ${{ env.NORTHSTAR_VERSION }}
2022-03-13 20:59:21 +01:00
path : northstar-launcher
2022-01-12 22:47:04 +01:00
- name : Setup MSBuild
uses : microsoft/setup-msbuild@v1.1
2022-01-19 19:32:25 +01:00
- name : Setup resource file version
shell : bash
2022-03-13 20:59:21 +01:00
working-directory : northstar-launcher
2022-01-19 19:32:25 +01:00
run : |
sed -i 's/DEV/${{ env.NORTHSTAR_VERSION }}/g' LauncherInjector/resources.rc
2022-05-13 02:12:53 +02:00
FILEVERSION=$(echo ${{ env.NORTHSTAR_VERSION }} | tr '.' ',' | sed -E 's/-rc[0-9]+//' | tr -d '[:alpha:]')
2022-04-28 00:46:50 +02:00
sed -i "s/0,0,0,1/${FILEVERSION}/g" NorthstarDedicatedTest/ns_version.h
2022-01-12 22:47:04 +01:00
- name : Build
2022-04-16 01:06:14 +02:00
working-directory : northstar-launcher
2022-03-13 20:59:21 +01:00
run : |
cp -r ../discord-plugin/*Discord* .
msbuild /p:Configuration=Release R2Northstar.sln
msbuild /p:Configuration=Release NorthstarDiscordRPC.sln
2022-03-04 23:51:32 +01:00
- name : Upload launcher build as artifact
2022-01-12 22:47:04 +01:00
uses : actions/upload-artifact@v2
with :
name : northstar-launcher
path : |
2022-03-13 20:59:21 +01:00
northstar-launcher/x64/Release/Northstar.dll
northstar-launcher/x64/Release/wsock32.dll
northstar-launcher/x64/Release/NorthstarLauncher.exe
2022-03-26 22:41:49 +01:00
northstar-launcher/x64/Release/discord_game_sdk.dll
2022-03-13 20:59:21 +01:00
northstar-launcher/x64/Release/DiscordRPC.dll
northstar-launcher/x64/Release/*.txt
2022-03-04 23:51:32 +01:00
- name : Upload debug build artifact
uses : actions/upload-artifact@v2
with :
name : launcher-debug-files
path : |
2022-03-13 20:59:21 +01:00
northstar-launcher/x64/Release/*.pdb
2022-01-12 22:47:04 +01:00
build-northstar :
needs : build-launcher
runs-on : ubuntu-20.04
steps :
- name : Download compiled launcher
uses : actions/download-artifact@v2
with :
name : northstar-launcher
path : northstar-launcher
2022-02-17 12:10:12 +01:00
- name : Download compiled stubs
run :
wget "https://github.com/R2Northstar/NorthstarStubs/releases/download/v1/NorthstarStubs.zip"
2022-02-17 04:58:02 +01:00
- name : Checkout release files
2022-01-12 22:47:04 +01:00
uses : actions/checkout@v2
with :
ref : ${{ env.NORTHSTAR_VERSION }}
path : northstar
2022-02-17 04:58:02 +01:00
- name : Checkout core mods
2022-01-12 22:47:04 +01:00
uses : actions/checkout@v2
with :
repository : R2Northstar/NorthstarMods
ref : ${{ env.NORTHSTAR_VERSION }}
path : northstar-mods
2022-02-02 00:07:37 +01:00
- name : Update mod version info
run : |
export MOD_VERSION=$(echo $NORTHSTAR_VERSION | tr -d 'v')
cat <<< $(jq ".Version = \"${MOD_VERSION}\"" northstar-mods/Northstar.Client/mod.json) > northstar-mods/Northstar.Client/mod.json
cat <<< $(jq ".Version = \"${MOD_VERSION}\"" northstar-mods/Northstar.Custom/mod.json) > northstar-mods/Northstar.Custom/mod.json
cat <<< $(jq ".Version = \"${MOD_VERSION}\"" northstar-mods/Northstar.CustomServers/mod.json) > northstar-mods/Northstar.CustomServers/mod.json
2022-02-17 16:50:02 +01:00
- name : Generate md5sum file
2022-03-13 21:07:44 +01:00
working-directory : northstar-mods
2022-02-17 16:50:02 +01:00
run : |
echo -e "# Check with 'md5sum -c md5sum.txt' at the root of mods folder\n" > md5sum.txt
git ls-tree -r $NORTHSTAR_VERSION --name-only | xargs -L1 md5sum >> md5sum.txt
2022-02-17 04:58:02 +01:00
- name : Make folder structure
2022-01-12 22:47:04 +01:00
run : |
2022-03-16 03:48:17 +01:00
mv -v northstar/release/* northstar/.
2022-01-12 22:47:04 +01:00
mkdir -p northstar/R2Northstar/mods
2022-03-13 20:59:21 +01:00
mkdir -p northstar/R2Northstar/plugins
2022-01-12 22:47:04 +01:00
mkdir -p northstar/bin/x64_retail
2022-04-28 15:36:16 +02:00
2022-03-16 03:48:17 +01:00
mv -v northstar-launcher/DiscordRPC.dll northstar/R2Northstar/plugins
2022-03-26 22:41:49 +01:00
mv -v northstar-launcher/discord_game_sdk.dll northstar
2022-03-16 03:48:17 +01:00
mv -v northstar-launcher/wsock32.dll northstar/bin/x64_retail
2022-02-17 12:10:12 +01:00
unzip NorthstarStubs.zip -d northstar/bin/x64_dedi
2022-04-28 15:36:16 +02:00
2022-03-16 03:48:17 +01:00
mv -v northstar-launcher/* northstar
2022-01-12 22:47:04 +01:00
rsync -avr --exclude="Northstar.Coop" --exclude=".git*" northstar-mods/. northstar/R2Northstar/mods
2022-04-28 15:55:33 +02:00
- name : Checkout Navmesh repository
uses : actions/checkout@v2
with :
repository : R2Northstar/NorthstarNavs
path : northstar-navs
- name : Navmeshes setup
run : |
mkdir -p northstar/R2Northstar/mods/Northstar.CustomServers/mod/maps
mv -v northstar-navs/graphs northstar/R2Northstar/mods/Northstar.CustomServers/mod/maps
mv -v northstar-navs/navmesh northstar/R2Northstar/mods/Northstar.CustomServers/mod/maps
2022-04-28 15:36:16 +02:00
- name : Cleanup root Northstar repository files
2022-04-28 15:55:33 +02:00
working-directory : northstar
2022-01-12 22:47:04 +01:00
run : |
2022-04-28 15:55:33 +02:00
rm -rf .git .github .gitignore *.md LICENSE thunderstore .ci.env.example
2022-01-12 22:47:04 +01:00
- name : Upload
uses : actions/upload-artifact@v2
with :
name : Northstar.release.${{ env.NORTHSTAR_VERSION }}
path : northstar
2022-04-16 01:06:14 +02:00
build-thunderstore-package :
needs : build-northstar # comment out when running locally
env :
# Release envs, comment this out when running locally
TCLI_AUTH_TOKEN : ${{ secrets.THUNDERSTORE_TOKEN }}
TS_REPO : https://thunderstore.io/
TS_COMMUNITY : northstar
# Uncomment when testing locally, must be unique
2022-04-19 03:20:42 +02:00
# NORTHSTAR_VERSION: 0.1.8
2022-04-16 01:06:14 +02:00
# Thunderstore info and descriptions
TS_NAMESPACE : northstar
TS_MOD_NAME : Northstar
TS_MOD_DESCRIPTION : Titanfall 2 modding and custom server framework.
runs-on : ubuntu-20.04
steps :
- name : Setup tcli
run : |
2022-04-28 15:16:24 +02:00
wget -O tcli.tar.gz https://github.com/thunderstore-io/thunderstore-cli/releases/download/0.1.4/tcli-0.1.4-linux-x64.tar.gz
tar xvf tcli.tar.gz
2022-04-28 22:38:45 +02:00
sudo mv -v tcli-0.1.4-linux-x64/tcli /bin
2022-04-16 01:06:14 +02:00
- name : (DEBUG) Download Northstar package
2022-04-28 15:16:24 +02:00
if : ${{ env.ACT }} # Download Northstar package from releases when running locally instead of relying on previous jobs
2022-04-16 01:06:14 +02:00
run : |
2022-04-17 20:25:50 +02:00
wget -O northstar.zip https://github.com/R2Northstar/Northstar/releases/download/v1.6.3/Northstar.release.v1.6.3.zip
unzip northstar.zip -d northstar
2022-04-16 01:06:14 +02:00
2022-04-19 03:20:42 +02:00
- name : Download Northstar package
if : ${{ !env.ACT }} # Download artifacts from previous jobs when running on GitHub's infrastructure
2022-04-16 01:06:14 +02:00
uses : actions/download-artifact@v2
with :
name : Northstar.release.${{ env.NORTHSTAR_VERSION }}
path : northstar
- name : Make package structure
run : |
mkdir -p thunderstore/dist/Northstar
2022-04-17 20:25:50 +02:00
rm northstar/ns_startup*.txt
2022-04-16 01:06:14 +02:00
mv -v northstar/* thunderstore/dist/Northstar
2022-04-17 20:25:50 +02:00
wget -O thunderstore/icon.png https://raw.githubusercontent.com/R2Northstar/Northstar/main/thunderstore/icon.png
wget -O thunderstore/README.md https://raw.githubusercontent.com/R2Northstar/Northstar/main/thunderstore/README.md
2022-04-16 01:06:14 +02:00
- name : Setup environment variables
run : |
2022-07-19 00:58:20 +02:00
# Strip leading `v` and if exists replace `-rc` with `0` and strip leading zeroes from last semver digit if necessary
echo "MOD_VERSION=$(echo $NORTHSTAR_VERSION | tr -d 'v'| sed --expression 's/-rc/0/' | sed -E 's/([0-9])\.([0-9])\.(0*)([0-9])/\1.\2.\4/;')" >> $GITHUB_ENV
# If it's a release candidate we also want to change a few things
if [[ $NORTHSTAR_VERSION == *"-rc"* ]]; then
# We want to push to a different package
# i.e. `NorthstarReleaseCandidate` vs `Northstar`
echo "TS_MOD_NAME=NorthstarReleaseCandidate" >> $GITHUB_ENV
# And update mod description
echo "TS_MOD_DESCRIPTION=Release candidate for next Northstar release." >> $GITHUB_ENV
# Add disclaimer add the top of README
echo -e '> ⚠️ This is a release candidate. Please report bugs or other issues on GitHub ⚠️\n' | cat - thunderstore/README.md > temp && mv temp thunderstore/README.md
fi
2022-04-16 01:06:14 +02:00
- name : Publish package to Thunderstore
working-directory : thunderstore
run : |
tcli init --package-name=$TS_MOD_NAME --package-namespace=$TS_NAMESPACE --package-version $MOD_VERSION
sed -i "s/communities = \[\]/communities = [\"$TS_COMMUNITY\"]/g" thunderstore.toml
sed -i "s/Example-Dependency = \"1.0.0\"//g" thunderstore.toml
sed -i "s/description = \"Example mod description\"/description = \"$TS_MOD_DESCRIPTION\"/g" thunderstore.toml
cat thunderstore.toml
tcli build
tcli publish --repository "$TS_REPO" --file build/*.zip