Merge pull request #176487 from SuperSandro2000/asf-update

This commit is contained in:
Sandro 2022-06-06 21:12:45 +02:00 committed by GitHub
commit 81fa70910c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 16 deletions

View file

@ -41,7 +41,7 @@ buildDotnetModule rec {
'';
passthru = {
updateScript = ./updater.sh;
updateScript = ./update.sh;
ui = callPackage ./web-ui { };
};

View file

@ -1,6 +1,6 @@
#!/usr/bin/env nix-shell
#!nix-shell -I nixpkgs=../../../.. -i bash -p curl gnused jq common-updater-scripts nuget-to-nix
set -exo pipefail
set -euox pipefail
cd "$(dirname "${BASH_SOURCE[0]}")"
deps_file="$(realpath ./deps)"
@ -15,15 +15,21 @@ if [[ "$new_version" == "$old_version" ]]; then
fi
fi
asf_path=$(pwd)
cd ../../../..
nixpkgs_path=$(pwd)
if [[ "$1" != "--deps-only" ]]; then
if [[ "${1:-}" != "--deps-only" ]]; then
update-source-version ArchiSteamFarm "$new_version"
fi
store_src="$(nix-build -A ArchiSteamFarm.src --no-out-link)"
platforms="$(nix-instantiate --strict --eval --json -A ArchiSteamFarm.meta.platforms | jq -r .[])"
src="$(mktemp -d /tmp/ArchiSteamFarm-src.XXX)"
trap '
rm -r "$src"
' EXIT
cp -rT "$store_src" "$src"
chmod -R +w "$src"
@ -36,15 +42,12 @@ for i in $platforms; do
nix-shell -I nixpkgs="$nixpkgs_path" -p dotnet-sdk_6 --argstr system $i --run "
mkdir ./nuget_pkgs-$i
for project in ArchiSteamFarm/ArchiSteamFarm.csproj ArchiSteamFarm.Tests/ArchiSteamFarm.Tests.csproj; do
dotnet restore $project --packages ./nuget_pkgs-$i
dotnet restore \$project --packages ./nuget_pkgs-$i
done;
nuget-to-nix ./nuget_pkgs-$i > $deps_file-$i.nix" \
|| echo "Did you set up binformat for $i?";
done;
trap '
popd
rm -r "$src"
' EXIT
cd "$asf_path"
./web-ui/update.sh

View file

@ -1,17 +1,19 @@
#!/usr/bin/env nix-shell
#! nix-shell -i bash -p nodePackages.node2nix gnused jq curl
#! nix-shell -I nixpkgs=../../../.. -i bash -p nodePackages.node2nix gnused jq curl
set -eoux pipefail
pushd ../../../..
version=$(nix-instantiate --strict --eval -A ArchiSteamFarm.version | jq -r)
ui=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/contents/ASF-ui?ref=${version} | jq -r .sha)
popd
pushd "$(dirname "$0")"
ui=$(curl ${GITHUB_TOKEN:+" -u \":$GITHUB_TOKEN\""} "https://api.github.com/repos/JustArchiNET/ArchiSteamFarm/contents/ASF-ui?ref=$version" | jq -r .sha)
pushd $(dirname "$0")
curl https://raw.githubusercontent.com/JustArchiNET/ASF-ui/${ui}/package-lock.json -o package-lock.json
curl https://raw.githubusercontent.com/JustArchiNET/ASF-ui/${ui}/package.json -o package.json
curl "https://raw.githubusercontent.com/JustArchiNET/ASF-ui/$ui/package-lock.json" -o package-lock.json
curl "https://raw.githubusercontent.com/JustArchiNET/ASF-ui/$ui/package.json" -o package.json
# update-source-version doesn't work for some reason
sed -i "s/rev\\s*=\\s*.*/rev = \"$ui\";/" default.nix
sed -i "s/sha256\\s*=\\s*.*/sha256 = \"$(nix-prefetch-url --unpack https://github.com/JustArchiNET/ASF-ui/archive/$ui.tar.gz)\";/" default.nix
sed -i "s/sha256\\s*=\\s*.*/sha256 = \"$(nix-prefetch-url --unpack "https://github.com/JustArchiNET/ASF-ui/archive/$ui.tar.gz")\";/" default.nix
node2nix \
--nodejs-14 \