Skip to content

Commit

Permalink
ci: attempt to deploy the demo to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
mscharley committed Jun 14, 2024
1 parent 00f49a1 commit 73f1a2f
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 1 deletion.
54 changes: 54 additions & 0 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# Simple workflow for deploying static content to GitHub Pages
name: Deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.tool-versions'
- uses: erlef/setup-beam@v1
with:
version-file: '.tool-versions'
version-type: 'strict'
- name: Build demo
run: ./bin/build-demo.sh
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './demo/out'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4

18 changes: 18 additions & 0 deletions bin/build-demo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env sh

# Move to the correct folder
cd demo/
set -x

# Do a build
gleam build

# Move all the static files into place
for f in index.html build/dev/javascript/lustre_ui/priv/static/lustre-ui.css; do
mkdir -p ./out/$(dirname $f)
cp ./$f ./out/$f
done

# Bundle all our JavaScript together
mkdir -p ./priv/static
./build/.lustre/bin/esbuild ./priv/static/commonmark_demo.mjs --bundle --outfile=./out/priv/static/commonmark_demo.mjs
1 change: 1 addition & 0 deletions demo/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
/build
/priv
erl_crash.dump
/out
1 change: 0 additions & 1 deletion demo/src/commonmark_demo/message.gleam
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import commonmark
import commonmark_demo/model.{type Model, Model}
import gleam/io
import lustre/effect

pub type Msg {
Expand Down

0 comments on commit 73f1a2f

Please sign in to comment.