Skip to content

Commit 3890b6f

Browse files
Create deploy workflow (#2)
1 parent 289870c commit 3890b6f

File tree

7 files changed

+76
-25
lines changed

7 files changed

+76
-25
lines changed

.github/workflows/deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
on:
2+
push:
3+
branches:
4+
- main
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
env:
10+
CI: true
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Use Node.js 20.x
14+
uses: actions/setup-node@v4
15+
with:
16+
node-version: 20.x
17+
- name: Get yarn cache
18+
id: yarn-cache
19+
run: echo "::set-output name=dir::$(yarn cache dir)"
20+
- uses: actions/cache@v4
21+
with:
22+
path: ${{ steps.yarn-cache.outputs.dir }}
23+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
24+
restore-keys: |
25+
${{ runner.os }}-yarn-
26+
- name: Cache node modules
27+
uses: actions/cache@v4
28+
with:
29+
path: node_modules
30+
key: ${{ runner.OS }}-build-${{ hashFiles('**/yarn.lock') }}
31+
restore-keys: |
32+
${{ runner.OS }}-node_modules-
33+
- name: yarn install
34+
run: yarn install --frozen-lockfile
35+
- name: yarn build
36+
run: yarn build
37+
- name: Upload Page Artifact
38+
uses: actions/upload-pages-artifact@v3
39+
with:
40+
path: ./dist/
41+
42+
deploy:
43+
needs: build
44+
permissions:
45+
pages: write # to deploy to Pages
46+
id-token: write # to verify the deployment originates from an appropriate source
47+
actions: read # to access artifacts from the build job
48+
environment:
49+
name: github-pages
50+
url: ${{ steps.deployment.outputs.page_url }}
51+
runs-on: ubuntu-latest
52+
steps:
53+
- name: Deploy to GitHub Pages
54+
id: deployment
55+
uses: actions/deploy-pages@v4

src/baseline/baseline-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const simpleRow = b.row([
2626
b.char("0"),
2727
]);
2828

29-
const BaselinePage: React.FunctionComponent = () => {
29+
const BaselinePage = () => {
3030
const [stixFontData, setStixFontData] = React.useState<FontData | null>(null);
3131

3232
React.useEffect(() => {

src/editor/editor-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import { examples } from "./examples";
2323

2424
const initialExample = 1;
2525

26-
const EditorPage: React.FunctionComponent = () => {
26+
const EditorPage = () => {
2727
const [stixFontData, setStixFontData] = React.useState<FontData | null>(null);
2828
const [lmFontData, setLmFontData] = React.useState<FontData | null>(null);
2929
const [bonumFontData, setBonumFontData] = React.useState<FontData | null>(

src/parser/parser-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ const simpleRow = builders.row([
2626
builders.char("0"),
2727
]);
2828

29-
const EditorPage: React.FunctionComponent = () => {
29+
const EditorPage = () => {
3030
const [tab, setTab] = React.useState<"parse" | "edit">("parse");
3131
const [stixFontData, setStixFontData] = React.useState<FontData | null>(null);
3232
const [editTree, setEditTree] = React.useState<State["row"]>(simpleRow);

src/shared/formatting-palette.tsx

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,17 @@
1-
import * as React from 'react';
2-
3-
type EmptyProps = Record<string, never>;
4-
51
type FormattingEvent =
62
| {
7-
readonly type: 'color';
3+
readonly type: "color";
84
readonly value: string;
95
}
106
| {
11-
readonly type: 'cancel';
7+
readonly type: "cancel";
128
}
139
| {
14-
readonly type: 'uncancel';
10+
readonly type: "uncancel";
1511
};
1612

1713
// TODO: determine the color based on the current selection
18-
const FormattingPalette: React.FC<EmptyProps> = (props) => {
14+
const FormattingPalette = () => {
1915
return (
2016
<div>
2117
<input
@@ -24,9 +20,9 @@ const FormattingPalette: React.FC<EmptyProps> = (props) => {
2420
const color = e.target.value;
2521

2622
if (document.activeElement) {
27-
const event = new CustomEvent<FormattingEvent>('formatting', {
23+
const event = new CustomEvent<FormattingEvent>("formatting", {
2824
detail: {
29-
type: 'color',
25+
type: "color",
3026
value: color,
3127
},
3228
bubbles: true,
@@ -40,9 +36,9 @@ const FormattingPalette: React.FC<EmptyProps> = (props) => {
4036
<button
4137
onClick={() => {
4238
if (document.activeElement) {
43-
const event = new CustomEvent<FormattingEvent>('formatting', {
39+
const event = new CustomEvent<FormattingEvent>("formatting", {
4440
detail: {
45-
type: 'cancel',
41+
type: "cancel",
4642
},
4743
bubbles: true,
4844
cancelable: true,
@@ -57,9 +53,9 @@ const FormattingPalette: React.FC<EmptyProps> = (props) => {
5753
<button
5854
onClick={() => {
5955
if (document.activeElement) {
60-
const event = new CustomEvent<FormattingEvent>('formatting', {
56+
const event = new CustomEvent<FormattingEvent>("formatting", {
6157
detail: {
62-
type: 'uncancel',
58+
type: "uncancel",
6359
},
6460
bubbles: true,
6561
cancelable: true,

src/shared/layout.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
import * as React from 'react';
1+
import * as React from "react";
22

33
type Props = {
44
readonly style?: React.CSSProperties;
55
readonly children: React.ReactNode;
66
};
77

8-
export const HStack: React.FunctionComponent<Props> = (props) => {
8+
export const HStack = (props: Props) => {
99
const style: React.CSSProperties = {
1010
...props.style,
11-
display: 'flex',
12-
flexDirection: 'row',
11+
display: "flex",
12+
flexDirection: "row",
1313
};
1414

1515
return <div style={style}>{props.children}</div>;
1616
};
1717

18-
export const VStack: React.FunctionComponent<Props> = (props) => {
18+
export const VStack = (props: Props) => {
1919
const style: React.CSSProperties = {
2020
...props.style,
21-
display: 'flex',
22-
flexDirection: 'column',
21+
display: "flex",
22+
flexDirection: "column",
2323
};
2424

2525
return <div style={style}>{props.children}</div>;

src/solver/solver-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ const safeParse = (input: Editor.types.CharRow): Semantic.types.Node | null => {
3535
// - use the colorMap option to highlight related nodes between steps
3636
// e.g. 2(x + y) -> 2x + 2y the 2s would be the same color, etc.
3737

38-
const SolverPage: React.FunctionComponent = () => {
38+
const SolverPage = () => {
3939
const [input, setInput] = React.useState(initialInput);
4040
const [answer, setAnswer] = React.useState<Editor.types.CharRow | null>(null);
4141
const [step, setStep] = React.useState<Solver.Step | null>(null);

0 commit comments

Comments
 (0)