diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe20d5c..c9a75e7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -307,12 +307,15 @@ jobs: # Substitute from Attic cache (fast) ssh "$VPS_USER@$VPS_HOST" \ "sudo /nix/var/nix/profiles/default/bin/nix-store --realise '$STORE_PATH'" - # Update profile + sync git repo + restart + # Update profile + sync git repo + sync .next + restart ssh "$VPS_USER@$VPS_HOST" \ - "sudo /nix/var/nix/profiles/default/bin/nix-env \ + "sudo /nix/var/nix/profiles/default/bin/nix-store --realise '$STORE_PATH' && \ + sudo /nix/var/nix/profiles/default/bin/nix-env \ --profile /nix/var/nix/profiles/mcpedia-web \ --set '$STORE_PATH' && \ (cd /home/code/mcpedia && git fetch origin main && git reset --hard origin/main) && \ + rm -rf /home/code/mcpedia/apps/web/.next && \ + cp -r '$STORE_PATH/share/mcpedia-web/.next' /home/code/mcpedia/apps/web/.next && \ sudo systemctl restart mcpedia-web && \ sleep 3 && \ sudo systemctl status mcpedia-web --no-pager --no-legend | head -5" diff --git a/web.nix b/web.nix index 65fcdd0..0632140 100644 --- a/web.nix +++ b/web.nix @@ -3,23 +3,11 @@ # so .next is built in CI via `bun run build` and packaged here. { pkgs , stdenv -, writeShellScriptBin , bun , webNextDir , ... }: -let - mcpedia-web-script = writeShellScriptBin "mcpedia-web" '' - #!${pkgs.bash}/bin/bash - export NODE_ENV=production - export PORT=4016 - cd /home/code/mcpedia/apps/web - rm -f .next - ln -s "${webNextDir}" .next - exec "${bun}/bin/bun" x next start -p 4016 - ''; -in stdenv.mkDerivation { pname = "mcpedia-web"; version = "1.0.0"; @@ -31,6 +19,15 @@ stdenv.mkDerivation { cp -r "${webNextDir}/." $out/share/mcpedia-web/.next/ mkdir -p $out/bin - cp ${mcpedia-web-script}/bin/mcpedia-web $out/bin/mcpedia-web + cat > $out/bin/mcpedia-web <