Skip to content

Commit aa2f45d

Browse files
committed
Upload static files as artifact
1 parent 7422a7d commit aa2f45d

File tree

6 files changed

+52
-14
lines changed

6 files changed

+52
-14
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,28 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
15+
name: Build static files
16+
id: build
17+
uses: actions/checkout@v4
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version-file: ".nvmrc"
21+
cache: "npm"
22+
run: npm ci
23+
run: npm run build
24+
- name: Upload static files as artifact
25+
id: deployment
26+
uses: actions/upload-pages-artifact@v3
1727
with:
18-
node-version-file: ".nvmrc"
19-
cache: "npm"
20-
- run: npm ci
21-
- run: npm run build
28+
path: public/
2229

2330
deploy:
2431
needs: build
2532

2633
permissions:
2734
pages: write
2835
id-token: write
36+
actions: read
2937

3038
environment:
3139
name: github-pages

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
node_modules
22
elm-stuff
33
.DS_Store
4-
.idea
4+
.idea
5+
6+
# Build output
7+
public/main.js

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"name": "guida-lang.org",
33
"version": "1.0.0",
44
"scripts": {
5-
"build": "elm make src/Main.elm"
5+
"build": "elm make src/Main.elm --output=public/main.js"
66
},
77
"dependencies": {
88
"elm": "^0.19.1-6"
99
}
10-
}
10+
}

public/index.html

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<!DOCTYPE HTML>
2+
<html>
3+
4+
<head>
5+
<meta charset="UTF-8">
6+
<title>Guida</title>
7+
<link rel="stylesheet" href="main.css">
8+
<script src="main.js"></script>
9+
</head>
10+
11+
<body>
12+
<script>var app = Elm.Main.init();</script>
13+
</body>
14+
15+
</html>

public/main.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
* {
2+
margin: 0;
3+
padding: 0;
4+
box-sizing: border-box;
5+
}

src/Main.elm

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,17 @@ import Browser
44
import Html
55

66

7-
main : Program () {} ()
7+
main : Program () () ()
88
main =
9-
Browser.sandbox
10-
{ init = {}
11-
, update = \_ _ -> {}
12-
, view = \_ -> Html.h1 [] [ Html.text "Hello Guida!" ]
9+
Browser.document
10+
{ init = \_ -> ( (), Cmd.none )
11+
, view =
12+
\_ ->
13+
{ title = "Guida"
14+
, body =
15+
[ Html.h1 [] [ Html.text "Hello Guida!" ]
16+
]
17+
}
18+
, update = \_ _ -> ( (), Cmd.none )
19+
, subscriptions = \_ -> Sub.none
1320
}

0 commit comments

Comments
 (0)