File tree 6 files changed +12
-17
lines changed
6 files changed +12
-17
lines changed Original file line number Diff line number Diff line change 12
12
deploy :
13
13
runs-on : ubuntu-22.04
14
14
15
+ env :
16
+ PUBLIC_API_URL : ${{ secrets.PUBLIC_API_URL }}
17
+
15
18
steps :
16
19
- name : Checkout 🛎️
17
20
uses : actions/checkout@v3
33
36
34
37
- name : Build 🛠️
35
38
run : pnpm build:prod
36
- env :
37
- API_PROJECTS_URL : ${{ secrets.API_PROJECTS_URL }}
38
39
39
40
- name : Deploy 🚀
40
41
uses : JamesIves/github-pages-deploy-action@v4
Original file line number Diff line number Diff line change
1
+ import { loadEnv } from 'vite'
1
2
import { defineConfig } from 'astro/config'
2
3
import { getAstroConfig } from 'shared/config/astro'
3
4
4
- const config = getAstroConfig ( )
5
+ const { PUBLIC_API_URL } = loadEnv ( '' , '' , 'PUBLIC' )
6
+ const { hostname } = new URL ( PUBLIC_API_URL )
7
+ const config = getAstroConfig ( { hostname } )
5
8
6
9
// https://astro.build/config
7
10
export default defineConfig ( config )
Original file line number Diff line number Diff line change @@ -2,15 +2,13 @@ import icon from 'astro-icon'
2
2
import tailwind from '@astrojs/tailwind'
3
3
import type { AstroUserConfig } from 'astro/config'
4
4
5
- import { API_URL } from '../consts'
6
-
7
5
export interface GetAstroConfig {
8
6
project ?: string
7
+ hostname ?: string
9
8
}
10
9
11
- export function getAstroConfig ( { project } : GetAstroConfig = { } ) : AstroUserConfig {
10
+ export function getAstroConfig ( { project, hostname } : GetAstroConfig = { } ) : AstroUserConfig {
12
11
const assets = 'assets'
13
- const { hostname } = new URL ( API_URL )
14
12
const hasProjectName = typeof project === 'string'
15
13
const outDir = hasProjectName ? `../../dist/${ project } ` : undefined
16
14
const base = hasProjectName ? `/frontendmentor/${ project } ` : '/frontendmentor'
@@ -22,8 +20,6 @@ export function getAstroConfig ({ project }: GetAstroConfig = {}): AstroUserConf
22
20
build : {
23
21
assets
24
22
} ,
25
- image : {
26
- domains : [ hostname ]
27
- }
23
+ image : hostname ? { domains : [ hostname ] } : undefined
28
24
}
29
25
}
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1
1
---
2
2
import { get } from ' shared/utils/http'
3
- import { API_URL } from ' shared/consts'
4
3
import MetaTags from ' shared/components/MetaTags.astro'
5
4
6
5
import Header from ' @/components/Header.astro'
@@ -35,7 +34,7 @@ interface Landing {
35
34
}
36
35
}
37
36
38
- const { footer, header } = await get <Landing >(API_URL + ' /landing/' )
37
+ const { footer, header } = await get <Landing >(import . meta . env . PUBLIC_API_URL + ' /landing/' )
39
38
const { designedBy, developedBy } = footer
40
39
const { navigation, profile } = header
41
40
---
Original file line number Diff line number Diff line change 1
1
---
2
2
import { get } from ' shared/utils/http'
3
- import { API_URL } from ' shared/consts'
4
3
5
4
import Card from ' @/components/Card.astro'
6
5
import Layout from ' @/layouts/Layout.astro'
@@ -17,7 +16,7 @@ interface Projects {
17
16
title: string
18
17
}
19
18
20
- const { results } = await get <{ results: Projects [] }>(API_URL + ' /projects/' )
19
+ const { results } = await get <{ results: Projects [] }>(import . meta . env . PUBLIC_API_URL + ' /projects/' )
21
20
const hasProjects = results .length > 0
22
21
---
23
22
You can’t perform that action at this time.
0 commit comments