diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c7c3992..308a12b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -77,12 +77,14 @@ jobs: _build ~/.cargo/registry ~/.cargo/git - key: ${{ runner.os }}-mix-prod-${{ hashFiles('mix.lock', 'mise.toml') }} + assets/node_modules + key: ${{ runner.os }}-mix-prod-${{ hashFiles('mix.lock', 'mise.toml', 'assets/package-lock.json') }} restore-keys: | ${{ runner.os }}-mix-prod- - run: mix local.hex --force - run: mix local.rebar --force + - run: npm ci --prefix assets --no-audit --no-fund - run: mix deps.get --only prod - run: mix assets.setup - run: mix assets.deploy diff --git a/deploy/README.md b/deploy/README.md index 48df37d..2f80cd0 100644 --- a/deploy/README.md +++ b/deploy/README.md @@ -18,6 +18,7 @@ Internet | Erlang | 28.5 | | Elixir | 1.19.5-otp-28 | | Rust | 1.98.1 | +| Node.js | 24 (asset build only) | | Postgres | `postgres:18.0`, pinned directly in the unified compose | | Caddy | 2.11.9 | | Docker | 29.9.3 | @@ -34,6 +35,7 @@ A new Ubuntu 24.04 VPS needs: - Docker Engine and the Compose plugin - Caddy - `curl`, `ca-certificates`, `libstdc++6`, `openssl` +- Node.js 24 + npm if you build the release on this host instead of CI - DNS and TLS for the domain - A non-root deploy user with SSH access @@ -307,6 +309,8 @@ Build on a machine matching Ubuntu 24.04 / glibc 2.39, or let CI do it. The release tarball is the contents of the release directory: ```sh +npm ci --prefix assets --no-audit --no-fund + export MIX_ENV=prod mix deps.get --only prod mix assets.deploy @@ -315,6 +319,9 @@ mix release tar -czf chesstrainer-release.tar.gz -C _build/prod/rel/chesstrainer . ``` +`npm ci` is required before `mix assets.deploy`: Tailwind imports the +Chessground CSS and esbuild bundles the package from `assets/node_modules`. + `mix assets.deploy` runs `compile` first so the generated LiveView colocated CSS exists. diff --git a/mise.toml b/mise.toml index 561e857..f008618 100644 --- a/mise.toml +++ b/mise.toml @@ -2,3 +2,4 @@ erlang = "28.5" elixir = "1.19.5-otp-28" rust = "1.98.1" +node = "24"