Skip to content

Commit

Permalink
add pages build ci
Browse files Browse the repository at this point in the history
  • Loading branch information
nagisa committed Feb 11, 2025
1 parent 482ef0f commit b8d1c50
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 3 deletions.
35 changes: 35 additions & 0 deletions .github/workflows/build-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Pages

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

on:
pull_request:
merge_group:
push:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- run: nix develop -c 'just ghpages'
- uses: actions/upload-pages-artifact@v3
with:
path: _site/

# Deployment job
# deploy:
# environment:
# name: github-pages
# url: ${{ steps.deployment.outputs.page_url }}
# runs-on: ubuntu-latest
# needs: build
# steps:
# - name: Deploy to GitHub Pages
# id: deployment
# uses: actions/deploy-pages@v4
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/target
/pkg
/_site
9 changes: 9 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
build *BUILDFLAGS: # pass `--dev --no-opt` for debugging the glue itself
wasm-pack build --target=web {{ BUILDFLAGS }}

ghpages: build
mkdir _site
cp -v *.html _site
cp -v *.js _site
cp -v *.css _site
mv -v pkg _site
17 changes: 14 additions & 3 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,21 @@
flake-utils.url = "github:numtide/flake-utils";
};

outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system: rec {
devShells.default = with nixpkgs.legacyPackages.${system}; mkShell {
outputs = { self, nixpkgs, flake-utils }: flake-utils.lib.eachDefaultSystem (system:
with nixpkgs.legacyPackages.${system};
rec {
# Run a local development webserver (`nix run`)
apps.default = {
type = "app";
program = let script = writeScript "serve" ''
#!${bash}/bin/bash
${miniserve}/bin/miniserve --spa --index index.html .
''; in "${script}";
};
# Open a development shell (`nix develop`)
devShells.default = mkShell {
buildInputs = [
miniserve
just
wasm-pack
wasm-bindgen-cli
gcc
Expand Down
Empty file added neardebug.css
Empty file.

0 comments on commit b8d1c50

Please sign in to comment.