Skip to content

Commit 15b343e

Browse files
committed
Run Scala interpreter in the browser
1 parent 9f94dc2 commit 15b343e

File tree

71 files changed

+21152
-574
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+21152
-574
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
# GitHub Actions workflow to build and deploy the browser compiler demo to GitHub Pages
2+
3+
name: Deploy Demo to GitHub Pages
4+
5+
on:
6+
push:
7+
branches: [main, master, scala-interpreter]
8+
paths:
9+
- 'browser-interpreter/**'
10+
- '.github/workflows/deploy-pages.yml'
11+
pull_request:
12+
branches: [main, master]
13+
paths:
14+
- 'browser-interpreter/**'
15+
workflow_dispatch: # Allow manual trigger from any branch
16+
inputs:
17+
deploy:
18+
description: 'Deploy to GitHub Pages'
19+
required: false
20+
default: true
21+
type: boolean
22+
23+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
24+
permissions:
25+
contents: read
26+
pages: write
27+
id-token: write
28+
29+
# Allow only one concurrent deployment
30+
concurrency:
31+
group: "pages"
32+
cancel-in-progress: true
33+
34+
jobs:
35+
build:
36+
runs-on: ubuntu-latest
37+
38+
steps:
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Setup Java
43+
uses: actions/setup-java@v4
44+
with:
45+
distribution: 'temurin'
46+
java-version: '21'
47+
48+
- name: Setup sbt
49+
uses: sbt/setup-sbt@v1
50+
51+
- name: Build Scala.js
52+
working-directory: browser-interpreter
53+
run: sbt js/fastLinkJS
54+
55+
- name: Prepare deployment files
56+
run: |
57+
mkdir -p _site
58+
59+
# Find the Scala version from the build output
60+
SCALA_VERSION=$(ls browser-interpreter/js/target/ | grep scala | head -1)
61+
echo "Scala version: $SCALA_VERSION"
62+
63+
# Copy the demo HTML as index.html, updating the JS path if needed
64+
sed "s|js/target/scala-[0-9.]*|js/target/$SCALA_VERSION|g" \
65+
browser-interpreter/demo-compiler.html > _site/index.html
66+
67+
# Copy the generated JavaScript
68+
mkdir -p "_site/js/target/$SCALA_VERSION"
69+
cp -r "browser-interpreter/js/target/$SCALA_VERSION/browser-interpreter-js-fastopt" \
70+
"_site/js/target/$SCALA_VERSION/"
71+
72+
# Add .nojekyll to prevent Jekyll processing
73+
touch _site/.nojekyll
74+
75+
# Show what we're deploying
76+
echo "Deployment contents:"
77+
find _site -type f | head -20
78+
79+
- name: Setup Pages
80+
uses: actions/configure-pages@v4
81+
82+
- name: Upload artifact
83+
uses: actions/upload-pages-artifact@v3
84+
with:
85+
path: '_site'
86+
87+
deploy:
88+
# Only deploy on push to main/master or manual trigger with deploy=true
89+
if: |
90+
github.event_name == 'push' ||
91+
(github.event_name == 'workflow_dispatch' && inputs.deploy)
92+
environment:
93+
name: github-pages
94+
url: ${{ steps.deployment.outputs.page_url }}
95+
runs-on: ubuntu-latest
96+
needs: build
97+
98+
steps:
99+
- name: Deploy to GitHub Pages
100+
id: deployment
101+
uses: actions/deploy-pages@v4
102+

0 commit comments

Comments
 (0)