File tree 7 files changed +83
-21
lines changed
7 files changed +83
-21
lines changed Original file line number Diff line number Diff line change
1
+ # https://github.com/actions/deploy-pages#usage
2
+ name : Deploy to GitHub Pages
3
+
4
+ on :
5
+ workflow_dispatch :
6
+ push :
7
+ branches :
8
+ - github-pages
9
+
10
+ jobs :
11
+ build :
12
+ runs-on : ubuntu-latest
13
+ steps :
14
+ - uses : actions/checkout@v3
15
+ - run : corepack enable
16
+ - uses : actions/setup-node@v3
17
+ with :
18
+ node-version : " 18"
19
+
20
+ - run : pnpm install
21
+ - run : BASE_URL="/solid-hackernews" pnpm run build
22
+ env :
23
+ NITRO_PRESET : github_pages
24
+
25
+ - name : Upload artifact
26
+ uses : actions/upload-pages-artifact@v1
27
+ with :
28
+ path : ./.output/public
29
+
30
+ # Deployment job
31
+ deploy :
32
+ # Add a dependency to the build job
33
+ needs : build
34
+
35
+ # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
36
+ permissions :
37
+ pages : write # to deploy to Pages
38
+ id-token : write # to verify the deployment originates from an appropriate source
39
+
40
+ # Deploy to the github_pages environment
41
+ environment :
42
+ name : github_pages
43
+ url : ${{ steps.deployment.outputs.page_url }}
44
+
45
+ # Specify runner + deployment step
46
+ runs-on : ubuntu-latest
47
+ steps :
48
+ - name : Deploy to GitHub Pages
49
+ id : deployment
50
+ uses : actions/deploy-pages@v1
Original file line number Diff line number Diff line change 1
1
import { defineConfig } from "@solidjs/start/config" ;
2
2
3
+ const baseURL = process . env . BASE_URL || "" ;
4
+
3
5
export default defineConfig ( {
6
+ ssr : false ,
4
7
server : {
5
- preset : "netlify" ,
8
+ preset : "github_pages" ,
9
+ baseURL,
6
10
} ,
7
11
} ) ;
Original file line number Diff line number Diff line change @@ -5,9 +5,12 @@ import { Suspense } from "solid-js";
5
5
import "./app.css" ;
6
6
import Nav from "./components/nav" ;
7
7
8
+ const base = import . meta. env . SERVER_BASE_URL ;
9
+
8
10
export default function App ( ) {
9
11
return (
10
12
< Router
13
+ base = { base }
11
14
root = { ( props ) => (
12
15
< >
13
16
< Nav />
Original file line number Diff line number Diff line change 1
1
import { createSignal , For , Show } from "solid-js" ;
2
+ import { A } from "@solidjs/router" ;
2
3
import type { CommentDefinition } from "../types" ;
3
4
4
5
const pluralize = ( n : number ) => n + ( n === 1 ? " reply" : " replies" ) ;
@@ -9,7 +10,7 @@ export default function Comment(props: { comment: CommentDefinition }) {
9
10
return (
10
11
< li class = "comment" >
11
12
< div class = "by" >
12
- < a href = { `/users/${ props . comment . user } ` } > { props . comment . user } </ a > { " " }
13
+ < A href = { `/users/${ props . comment . user } ` } > { props . comment . user } </ A > { " " }
13
14
{ props . comment . time_ago } ago
14
15
</ div >
15
16
< div class = "text" innerHTML = { props . comment . content } />
Original file line number Diff line number Diff line change
1
+ import { A } from "@solidjs/router" ;
2
+
1
3
export default function Nav ( ) {
2
4
return (
3
5
< header class = "header" $ServerOnly >
4
6
< nav class = "inner" >
5
- < a href = "/" >
7
+ < A href = "/" >
6
8
< strong > HN</ strong >
7
- </ a >
8
- < a href = "/new" >
9
+ </ A >
10
+ < A href = "/new" >
9
11
< strong > New</ strong >
10
- </ a >
11
- < a href = "/show" >
12
+ </ A >
13
+ < A href = "/show" >
12
14
< strong > Show</ strong >
13
- </ a >
14
- < a href = "/ask" >
15
+ </ A >
16
+ < A href = "/ask" >
15
17
< strong > Ask</ strong >
16
- </ a >
17
- < a href = "/job" >
18
+ </ A >
19
+ < A href = "/job" >
18
20
< strong > Jobs</ strong >
19
- </ a >
20
- < a
21
+ </ A >
22
+ < A
21
23
class = "github"
22
24
href = "http://github.com/solidjs/solid"
23
25
target = "_blank"
24
26
rel = "noreferrer"
25
27
>
26
28
Built with Solid
27
- </ a >
29
+ </ A >
28
30
</ nav >
29
31
</ header >
30
32
) ;
Original file line number Diff line number Diff line change 1
1
import {
2
2
createAsync ,
3
+ A ,
3
4
type RouteDefinition ,
4
5
cache ,
5
6
type RouteSectionProps ,
@@ -48,13 +49,13 @@ export default function Stories(props: RouteSectionProps) {
48
49
</ span >
49
50
}
50
51
>
51
- < a
52
+ < A
52
53
class = "page-link"
53
54
href = { `/${ type ( ) } ?page=${ page ( ) - 1 } ` }
54
55
aria-label = "Previous Page"
55
56
>
56
57
{ "<" } prev
57
- </ a >
58
+ </ A >
58
59
</ Show >
59
60
< span > page { page ( ) } </ span >
60
61
< Show
@@ -65,13 +66,13 @@ export default function Stories(props: RouteSectionProps) {
65
66
</ span >
66
67
}
67
68
>
68
- < a
69
+ < A
69
70
class = "page-link"
70
71
href = { `/${ type ( ) } ?page=${ page ( ) + 1 } ` }
71
72
aria-label = "Next Page"
72
73
>
73
74
more { ">" }
74
- </ a >
75
+ </ A >
75
76
</ Show >
76
77
</ div >
77
78
< main class = "news-list" >
Original file line number Diff line number Diff line change 1
1
import {
2
2
cache ,
3
3
createAsync ,
4
+ A ,
4
5
type RouteDefinition ,
5
6
type RouteSectionProps ,
6
7
} from "@solidjs/router" ;
@@ -25,15 +26,15 @@ export default function Story(props: RouteSectionProps) {
25
26
< Show when = { story ( ) } >
26
27
< div class = "item-view" >
27
28
< div class = "item-view-header" >
28
- < a href = { story ( ) ! . url } target = "_blank" >
29
+ < A href = { story ( ) ! . url } target = "_blank" >
29
30
< h1 > { story ( ) ! . title } </ h1 >
30
- </ a >
31
+ </ A >
31
32
< Show when = { story ( ) ! . domain } >
32
33
< span class = "host" > ({ story ( ) ! . domain } )</ span >
33
34
</ Show >
34
35
< p class = "meta" >
35
36
{ story ( ) ! . points } points | by{ " " }
36
- < a href = { `/users/${ story ( ) ! . user } ` } > { story ( ) ! . user } </ a > { " " }
37
+ < A href = { `/users/${ story ( ) ! . user } ` } > { story ( ) ! . user } </ A > { " " }
37
38
{ story ( ) ! . time_ago } ago
38
39
</ p >
39
40
</ div >
You can’t perform that action at this time.
0 commit comments