File tree 7 files changed +45
-23
lines changed
7 files changed +45
-23
lines changed Original file line number Diff line number Diff line change 29
29
build :
30
30
runs-on : ubuntu-latest
31
31
steps :
32
- - name : Checkout
33
- uses : actions/checkout@v3
32
+ - name : Checkout 🛎️
33
+ uses : actions/checkout@v4.1.3
34
34
- name : Detect package manager
35
35
id : detect-package-manager
36
36
run : |
@@ -74,15 +74,15 @@ jobs:
74
74
- name : Install dependencies
75
75
run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
76
76
- name : Build with Next.js
77
- run : ${{ steps.detect-package-manager.outputs.runner }} next build
77
+ run : ${{ steps.detect-package-manager.outputs.runner }} build && touch ./out/.nojekyll
78
78
env :
79
79
NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN : ${{ secrets.NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN }}
80
80
# - name: Static HTML export with Next.js
81
81
# run: ${{ steps.detect-package-manager.outputs.runner }} next export
82
- - name : Upload artifact
83
- uses : actions/upload-pages-artifact@v1
84
- with :
85
- path : ./out
82
+ # - name: Upload artifact
83
+ # uses: actions/upload-pages-artifact@v4
84
+ # with:
85
+ # path: ./out
86
86
87
87
# Deployment job
88
88
deploy :
92
92
runs-on : ubuntu-latest
93
93
needs : build
94
94
steps :
95
- - name : Deploy to GitHub Pages
96
- id : deployment
97
- uses : actions/deploy-pages@v1
95
+ # - name: Deploy to GitHub Pages
96
+ # id: deployment
97
+ # uses: actions/deploy-pages@v4
98
+ - name : Deploy 🚀
99
+ uses : JamesIves/github-pages-deploy-action@v4.6.0
100
+ with :
101
+ token : ${{ secrets.GITHUB_TOKEN }}
102
+ branch : main
103
+ folder : out
Original file line number Diff line number Diff line change 11
11
# production
12
12
/build
13
13
/.next
14
+ out
14
15
15
16
# misc
16
17
.DS_Store
Original file line number Diff line number Diff line change 2
2
import "@testing-library/jest-dom" ;
3
3
import { TextEncoder , TextDecoder } from "util" ;
4
4
5
+ jest . mock ( "next/config" , ( ) => ( ) => ( {
6
+ publicRuntimeConfig : {
7
+ NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN : "https://rekor.sigstore.dev" ,
8
+ } ,
9
+ } ) ) ;
10
+
5
11
Object . assign ( global , { TextDecoder, TextEncoder } ) ;
Original file line number Diff line number Diff line change @@ -7,6 +7,12 @@ const nextConfig = {
7
7
process . env . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN ,
8
8
} ,
9
9
reactStrictMode : true ,
10
+ assetPrefix : "./" ,
11
+ images : {
12
+ loader : "akamai" ,
13
+ path : "" ,
14
+ } ,
15
+ output : "export" ,
10
16
publicRuntimeConfig : {
11
17
// remove private env variables
12
18
processEnv : Object . fromEntries (
Original file line number Diff line number Diff line change 7
7
useState ,
8
8
} from "react" ;
9
9
import { RekorClient } from "rekor" ;
10
+ import getConfig from "next/config" ;
10
11
11
12
export interface RekorClientContext {
12
13
client : RekorClient ;
@@ -22,6 +23,7 @@ export const RekorClientProvider: FunctionComponent<PropsWithChildren<{}>> = ({
22
23
children,
23
24
} ) => {
24
25
const [ baseUrl , setBaseUrl ] = useState < string > ( ) ;
26
+ const { publicRuntimeConfig } = getConfig ( ) ;
25
27
26
28
const context : RekorClientContext = useMemo ( ( ) => {
27
29
/*
@@ -31,8 +33,8 @@ export const RekorClientProvider: FunctionComponent<PropsWithChildren<{}>> = ({
31
33
https://nextjs.org/docs/pages/building-your-application/configuring/environment-variables
32
34
*/
33
35
if ( baseUrl === undefined ) {
34
- if ( process . env . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN ) {
35
- setBaseUrl ( process . env . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN ) ;
36
+ if ( publicRuntimeConfig . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN ) {
37
+ setBaseUrl ( publicRuntimeConfig . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN ) ;
36
38
} else {
37
39
setBaseUrl ( "https://rekor.sigstore.dev" ) ;
38
40
}
Original file line number Diff line number Diff line change 1
1
import type { AppProps } from "next/app" ;
2
2
import "@patternfly/react-core/dist/styles/base.css" ;
3
+ import { NextPageContext } from "next" ;
3
4
4
5
function App ( { Component, pageProps } : AppProps ) {
5
6
return < Component { ...pageProps } /> ;
6
7
}
7
8
9
+ App . getInitialProps = async ( _ctx : NextPageContext ) => {
10
+ return {
11
+ props : {
12
+ NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN : process . env
13
+ . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN
14
+ ? process . env . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN
15
+ : null ,
16
+ } , // gets passed to the page component as props
17
+ } ;
18
+ } ;
19
+
8
20
export default App ;
Original file line number Diff line number Diff line change @@ -112,14 +112,3 @@ const PageComponent: NextPage = () => (
112
112
</ RekorClientProvider >
113
113
) ;
114
114
export default PageComponent ;
115
-
116
- export async function getServerSideProps ( ) {
117
- return {
118
- props : {
119
- NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN : process . env
120
- . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN
121
- ? process . env . NEXT_PUBLIC_REKOR_DEFAULT_DOMAIN
122
- : null ,
123
- } , // gets passed to the page component as props
124
- } ;
125
- }
You can’t perform that action at this time.
0 commit comments