New Build Pipeline (#763)

This commit is contained in:
cat_or_not 2026-08-09 17:25:45 -04:00 committed by GitHub
parent 95cd53461a
commit 2007023082
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 557 additions and 99 deletions

View file

@ -1,8 +1,8 @@
name: Release
on:
push:
tags:
- 'v*'
branches:
- main
workflow_dispatch:
inputs:
job:
@ -13,97 +13,51 @@ on:
permissions:
contents: write # Needed to write to GitHub draft release
env:
NORTHSTAR_VERSION: ${{ github.ref_name }}
DISCORD_RPC_VERSION: v14
jobs:
build-northstar:
runs-on: ubuntu-22.04
steps:
- name: Checkout release files
uses: actions/checkout@v4
with:
ref: ${{ env.NORTHSTAR_VERSION }}
path: northstar
- name: Wait for launcher release build to be ready
timeout-minutes: 30 # Only wait for 30 minutes. If we take longer, something probably broke
run:
bash northstar/wait_for_launcher_dl.sh $NORTHSTAR_VERSION
- name: Download compiled launcher
run:
wget "https://github.com/R2Northstar/NorthstarLauncher/releases/download/${{ env.NORTHSTAR_VERSION }}/northstar-launcher.zip"
- name: Download DiscordRPC plugin
run:
wget "https://github.com/R2Northstar/NorthstarDiscordRPC/releases/download/${{ env.DISCORD_RPC_VERSION }}/northstar-discord-rpc.zip"
- name: Download compiled stubs
run:
wget "https://github.com/R2Northstar/NorthstarStubs/releases/download/v1/NorthstarStubs.zip"
- name: Checkout core mods
uses: actions/checkout@v4
with:
repository: R2Northstar/NorthstarMods
ref: ${{ env.NORTHSTAR_VERSION }}
path: northstar-mods
- name: Update mod version info
run: |
export MOD_VERSION=$(echo $NORTHSTAR_VERSION | tr --delete '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
- name: Generate md5sum file
working-directory: northstar-mods
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
- name: Make folder structure
run: |
mv --verbose northstar/release/* northstar/.
rm --dir northstar/release
mkdir --parents northstar/R2Northstar/mods
mkdir --parents northstar/R2Northstar/plugins
mkdir --parents northstar/bin/x64_dedi
- name: Checkout
uses: actions/checkout@v5
unzip northstar-discord-rpc.zip -d northstar/R2Northstar/plugins
unzip NorthstarStubs.zip -d northstar/bin/x64_dedi
unzip northstar-launcher.zip -d northstar
rsync -avr --exclude="Northstar.Coop" --exclude=".git*" --exclude="*.md" northstar-mods/. northstar/R2Northstar/mods
- name: Checkout Navmesh repository
uses: actions/checkout@v4
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v35
with:
repository: R2Northstar/NorthstarNavs
ref: 'v4'
path: northstar-navs
- name: Navmeshes setup
nix_conf: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-substituters = https://attic.catornot.net/northstar https://nix-community.cachix.org
extra-trusted-public-keys = northstar:H8QBUAeduEw6jGl3HtGeW/79pMPv7wSCAv8BSUon3kw= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
- name: Build
run: |
mkdir --parents northstar/R2Northstar/mods/Northstar.CustomServers/mod/maps
mv --verbose northstar-navs/graphs northstar/R2Northstar/mods/Northstar.CustomServers/mod/maps
mv --verbose northstar-navs/navmesh northstar/R2Northstar/mods/Northstar.CustomServers/mod/maps
- name: Cleanup root Northstar repository files
working-directory: northstar
nix build
- name: Get Northstar version
run: |
rm -rf .git .github .gitignore *.md LICENSE thunderstore .ci.env.example *.sh
echo "NORTHSTAR_VERSION=$(nix eval --raw .#version)" >> "$GITHUB_ENV"
- name: Upload
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v5
with:
name: Northstar.release.${{ env.NORTHSTAR_VERSION }}
path: northstar
path: ./result
- name: Create zip to upload
run: |
cd northstar/
zip --recurse-paths --quiet Northstar.release.${{ env.NORTHSTAR_VERSION }}.zip .
mv Northstar.release.${{ env.NORTHSTAR_VERSION }}.zip ../
zip --recurse-paths --quiet Northstar.release.${{ env.NORTHSTAR_VERSION }}.zip ./result
- name: Compute SHA-512 checksum
run: |
sha512sum Northstar.release.${{ env.NORTHSTAR_VERSION }}.zip
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
sha512sum Northstar.release.${{ env.NORTHSTAR_VERSION }}.zip >> $GITHUB_STEP_SUMMARY
echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
- name: Upload zip to release draft
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/v') && !contains(env.NORTHSTAR_VERSION, '-rc')
with:
tag_name: v${{ env.NORTHSTAR_VERSION }}
draft: true
files: Northstar.release.${{ env.NORTHSTAR_VERSION }}.zip
@ -124,6 +78,22 @@ jobs:
TS_MOD_DESCRIPTION: Titanfall 2 modding and custom server framework.
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v35
with:
nix_conf: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
extra-substituters = https://attic.catornot.net/northstar https://nix-community.cachix.org
extra-trusted-public-keys = northstar:H8QBUAeduEw6jGl3HtGeW/79pMPv7wSCAv8BSUon3kw= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=
- name: Get Northstar version
run: |
echo "NORTHSTAR_VERSION=$(nix eval --raw .#version)" >> "$GITHUB_ENV"
- name: Setup tcli
run: |
wget --output-document tcli.tar.gz https://github.com/thunderstore-io/thunderstore-cli/releases/download/0.1.4/tcli-0.1.4-linux-x64.tar.gz
@ -133,12 +103,12 @@ jobs:
- name: (DEBUG) Download Northstar package
if: ${{ env.ACT }} # Download Northstar package from releases when running locally instead of relying on previous jobs
run: |
wget --output-document northstar.zip https://github.com/R2Northstar/Northstar/releases/download/v1.6.3/Northstar.release.v1.6.3.zip
wget --output-document northstar.zip https://github.com/R2Northstar/Northstar/releases/download/v1.31.10/Northstar.release.v1.31.10.zip
unzip northstar.zip -d northstar
- name: Download Northstar package
if: ${{ !env.ACT }} # Download artifacts from previous jobs when running on GitHub's infrastructure
uses: actions/download-artifact@v4
uses: actions/download-artifact@v5
with:
name: Northstar.release.${{ env.NORTHSTAR_VERSION }}
path: northstar

1
.gitignore vendored
View file

@ -1 +1,2 @@
.env
result*

240
flake.lock generated Normal file
View file

@ -0,0 +1,240 @@
{
"nodes": {
"discordrpc": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1785916714,
"narHash": "sha256-IFwzeHekKwDZ+s/JjcTdW0ETqcxGwHOhq8CeY/aTo4M=",
"owner": "R2Northstar",
"repo": "NorthstarDiscordRPC",
"rev": "0581ba83afa24e06d347b941d2746cc5b1cdea3e",
"type": "github"
},
"original": {
"owner": "R2Northstar",
"repo": "NorthstarDiscordRPC",
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"launcher": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": [
"nixpkgs"
],
"nixpkgs-24-11": "nixpkgs-24-11",
"treefmt-nix": []
},
"locked": {
"lastModified": 1786171985,
"narHash": "sha256-R6xh0uKmaccUu5oliVr1PhUw5ONFB9cjTLX//wm3Tpg=",
"ref": "refs/heads/main",
"rev": "1b0ce15673a0027b21639746fd74d4f7da1e504d",
"revCount": 776,
"submodules": true,
"type": "git",
"url": "https://github.com/R2Northstar/NorthstarLauncher.git"
},
"original": {
"rev": "1b0ce15673a0027b21639746fd74d4f7da1e504d",
"submodules": true,
"type": "git",
"url": "https://github.com/R2Northstar/NorthstarLauncher.git"
}
},
"mods": {
"flake": false,
"locked": {
"lastModified": 1786129397,
"narHash": "sha256-ejCJl1+Q1Mrg7znV1Ekf4t9ebRuRSEdW5TPWXlj6/kY=",
"owner": "R2Northstar",
"repo": "NorthstarMods",
"rev": "509b14c727c127754b3f2566ee39e548386412cb",
"type": "github"
},
"original": {
"owner": "R2Northstar",
"repo": "NorthstarMods",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1785967620,
"narHash": "sha256-IItrdb7Puk05RqOBWZYFC5X6Wl1sJmCfh5MWVHw5iMM=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "b7c2ada94fe99c15b0dbcf4d11fd7850b957a436",
"type": "github"
},
"original": {
"owner": "nixos",
"ref": "nixos-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs-24-11": {
"locked": {
"lastModified": 1731603435,
"narHash": "sha256-CqCX4JG7UiHvkrBTpYC3wcEurvbtTADLbo3Ns2CEoL8=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "8b27c1239e5c421a2bbc2c65d52e4a6fbf2ff296",
"type": "github"
},
"original": {
"owner": "NixOS",
"ref": "24.11",
"repo": "nixpkgs",
"type": "github"
}
},
"plugins": {
"inputs": {
"nixpkgs": [
"nixpkgs"
],
"rust-overlay": "rust-overlay_2"
},
"locked": {
"lastModified": 1785917045,
"narHash": "sha256-VCN6if6Sn9WBbwfl5O8smAhnwF3vBQaRcnBWOXc771U=",
"owner": "R2Northstar",
"repo": "NorthstarPlugins",
"rev": "9874a8b173ae034dd3d154874540b599a863e7df",
"type": "github"
},
"original": {
"owner": "R2Northstar",
"repo": "NorthstarPlugins",
"type": "github"
}
},
"root": {
"inputs": {
"discordrpc": "discordrpc",
"launcher": "launcher",
"mods": "mods",
"nixpkgs": "nixpkgs",
"plugins": "plugins",
"utils": "utils"
}
},
"rust-overlay": {
"inputs": {
"nixpkgs": [
"discordrpc",
"nixpkgs"
]
},
"locked": {
"lastModified": 1785820796,
"narHash": "sha256-sZXy8mzUMi2cOGulhoW4HWAZB6JhXOAx1x8J4auZFWk=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "b6916ba032e02122d6ed3064f40cabe937363d43",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"rust-overlay_2": {
"inputs": {
"nixpkgs": [
"plugins",
"nixpkgs"
]
},
"locked": {
"lastModified": 1785907205,
"narHash": "sha256-Ds1vTi53af4wDMAveSR/K0JnywDslLwmgwhVIiwnNmY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "c5cb13481d718fac906aa9cfd85f9b60e1a546cb",
"type": "github"
},
"original": {
"owner": "oxalica",
"repo": "rust-overlay",
"type": "github"
}
},
"systems": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
}
},
"root": "root",
"version": 7
}

69
flake.nix Normal file
View file

@ -0,0 +1,69 @@
{
description = "Northstar Nightly Builds";
inputs = {
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
utils.url = "github:numtide/flake-utils";
mods = {
url = "github:R2Northstar/NorthstarMods";
flake = false;
};
launcher = {
url = "git+https://github.com/R2Northstar/NorthstarLauncher.git?submodules=1&rev=1b0ce15673a0027b21639746fd74d4f7da1e504d";
inputs.nixpkgs.follows = "nixpkgs";
inputs.treefmt-nix.follows = "";
};
discordrpc = {
url = "github:R2Northstar/NorthstarDiscordRPC";
inputs.nixpkgs.follows = "nixpkgs";
};
plugins = {
url = "github:R2Northstar/NorthstarPlugins";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs =
{
self,
nixpkgs,
utils,
mods,
launcher,
discordrpc,
plugins,
}:
utils.lib.eachDefaultSystem (
system:
let
pkgs = nixpkgs.legacyPackages.${system};
in
{
formatter = pkgs.nixfmt-tree;
packages = {
default = self.packages.${system}.northstar;
}
// import ./pkgs {
inherit
self
pkgs
mods
launcher
discordrpc
plugins
system
;
version = self.version;
};
devShells.default = pkgs.mkShell {
nativeBuildInputs = [
pkgs.act
];
};
}
)
// {
version = "1.13.11";
};
}

48
pkgs/default.nix Normal file
View file

@ -0,0 +1,48 @@
{
self,
pkgs,
mods,
launcher,
discordrpc,
plugins,
system,
version,
...
}:
let
getPackage = pkg: self.packages.${system}.${pkg};
listToPackages =
list:
builtins.listToAttrs (
map (name: {
name = name;
value = getPackage name;
}) list
);
in
{
launcher = launcher.packages.${system}.default.overrideAttrs (final: {
version = version + ".0";
__intentionallyOverridingVersion = true;
});
mods = pkgs.callPackage ./mods { inherit mods version; };
discordrpc = discordrpc.packages.${system}.default;
plugins = plugins.packages.${system}.default;
northstar-stubs = pkgs.callPackage ./northstar-stubs { };
northstar-navs = pkgs.callPackage ./northstar-navs { };
northstar = pkgs.callPackage ./northstar (
{
inherit
version
;
}
// listToPackages [
"launcher"
"mods"
"discordrpc"
"plugins"
"northstar-stubs"
"northstar-navs"
]
);
}

43
pkgs/mods/default.nix Normal file
View file

@ -0,0 +1,43 @@
{
lib,
jq,
stdenv,
mods,
version,
}:
let
in
stdenv.mkDerivation (finalAttr: {
pname = "NorthstarMods";
inherit version;
src = mods;
noUnpack = true;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
mkdir -p $TMPDIR
cp -r $src/* $out
chmod -R u+w "$out"
${lib.getExe jq} ".Version = \"${version}\"" $out/Northstar.Client/mod.json > $TMPDIR/mod.json.tmp
rm $out/Northstar.Client/mod.json
mv $TMPDIR/mod.json.tmp $out/Northstar.Client/mod.json
${lib.getExe jq} ".Version = \"${version}\"" $out/Northstar.Custom/mod.json > $TMPDIR/mod.json.tmp
rm $out/Northstar.Custom/mod.json
mv $TMPDIR/mod.json.tmp $out/Northstar.Custom/mod.json
${lib.getExe jq} ".Version = \"${version}\"" $out/Northstar.CustomServers/mod.json > $TMPDIR/mod.json.tmp
rm $out/Northstar.CustomServers/mod.json
mv $TMPDIR/mod.json.tmp $out/Northstar.CustomServers/mod.json
'';
meta = {
description = finalAttr.pname;
homepage = "https://northstar.tf/";
license = lib.licenses.mit;
};
})

View file

@ -0,0 +1,31 @@
{
lib,
pkgs,
fetchzip,
}:
let
in
pkgs.stdenv.mkDerivation (finalAttr: {
pname = "NorthstarNavs";
version = "v4";
src = fetchzip {
url = "https://github.com/R2Northstar/NorthstarNavs/archive/refs/tags/${finalAttr.version}.zip";
hash = "sha256-e3f+cScOga5oD+qT0irh/ccPdx7gHnliQBfPgf+/NFM=";
};
noUnpack = true;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
cp -r ${finalAttr.src}/graphs $out
cp -r ${finalAttr.src}/navmesh $out
'';
meta = {
description = finalAttr.pname;
homepage = "https://northstar.tf/";
license = lib.licenses.mit;
};
})

View file

@ -0,0 +1,31 @@
{
lib,
pkgs,
fetchzip,
}:
let
in
pkgs.stdenv.mkDerivation (finalAttr: {
pname = "NorthstarStubs";
version = "v1";
src = fetchzip {
url = "https://github.com/R2Northstar/NorthstarStubs/releases/download/${finalAttr.version}/NorthstarStubs.zip";
hash = "sha256-NgChtI2jmbTwqsdT1bgjO+rbj17icSaSR4DvwM/0WDU=";
stripRoot = false;
};
noUnpack = true;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out/bin
cp -r ${finalAttr.src}/* $out/bin
'';
meta = {
description = finalAttr.pname;
homepage = "https://northstar.tf/";
license = lib.licenses.mit;
};
})

View file

@ -0,0 +1,51 @@
{
lib,
pkgs,
launcher,
mods,
discordrpc,
plugins,
northstar-stubs,
northstar-navs,
version,
}:
let
in
pkgs.stdenv.mkDerivation (finalAttr: {
pname = "Northstar";
inherit version;
src = ../.;
noUnpack = true;
phases = [ "installPhase" ];
installPhase = ''
mkdir -p $out
mkdir -p $out/bin/x64_dedi
mkdir -p $out/R2Northstar
mkdir -p $out/R2Northstar/mods/
mkdir -p $out/R2Northstar/plugins
mkdir -p $out/R2Northstar/mods/Northstar.CustomServers/mod/maps
cp -r ${discordrpc}/bin/* $out/R2Northstar/plugins/
cp -r ${plugins}/bin/* $out/R2Northstar/plugins/
cp -r ${mods}/* $out/R2Northstar/mods/
cp -r ${launcher}/* $out/
cp -r ${northstar-stubs}/bin/* $out/bin/x64_dedi
cp -r ${northstar-navs}/* $out/R2Northstar/mods/Northstar.CustomServers/mod/maps
mv $out/Northstar.dll $out/R2Northstar/Northstar.dll
mv $out/Northstar.pdb $out/R2Northstar/Northstar.pdb
cp -r ${../../release/LEGAL.txt} $out/R2Northstar/LEGAL.txt
cp -r ${../../release/r2ds.bat} $out/r2ds.bat
# make everything writable for the end user
chmod -R u+w "$out"
'';
meta = {
description = finalAttr.pname;
homepage = "https://northstar.tf/";
license = lib.licenses.mit;
};
})

View file

@ -1,26 +0,0 @@
#!/bin/bash
# Check if contains command line arg
if [ -z "$1" ]; then
echo "Missing command-line argument."
exit 1
fi
url="https://github.com/R2Northstar/NorthstarLauncher/releases/download/$1/northstar-launcher.zip"
wait_time_seconds=60
# Loop until the response code changes
while true; do
response=$(curl --silent --output /dev/null --write-out "%{http_code}" $url)
if [ $response -eq 404 ]; then
echo "Response is 404. Retrying in $wait_time_seconds seconds."
sleep $wait_time_seconds
else
echo "Site is accessible with response code $response."
break
fi
done
# 10 second sleep just in case we hit some weird race condition
# where files are still being uploaded but release is done
sleep 10