Skip to content

Commit 68bb932

Browse files
committed
fix(CI): Set up env. variables
1 parent 0043a94 commit 68bb932

3 files changed

Lines changed: 11 additions & 3 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
node-version: "20"
5050
cache: ${{ steps.detect-package-manager.outputs.manager }}
5151
- name: Setup Pages
52+
id: setup_pages
5253
uses: actions/configure-pages@v5
5354
with:
5455
# Automatically inject basePath in your Next.js configuration file and disable
@@ -70,6 +71,8 @@ jobs:
7071
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
7172
- name: Build with Next.js
7273
run: ${{ steps.detect-package-manager.outputs.runner }} next build
74+
env:
75+
NEXT_PUBLIC_PAGES_BASE_PATH: ${{ steps.setup_pages.outputs.base_path }}
7376
- name: Upload artifact
7477
uses: actions/upload-pages-artifact@v3
7578
with:

components/Resource.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
import { TAGS } from "@/data/tags";
44
import { IResource } from "@/data/resources";
5-
65
import { Card, Heading, Button, Box, Flex, Badge, Popover, Portal, Image } from "@chakra-ui/react";
76

7+
const pagesBasePath = process.env.NEXT_PUBLIC_PAGES_BASE_PATH;
8+
89
const Resource = ({ resource }: { resource: IResource }) => {
10+
911
const price = TAGS.price.list.find((p) => p.value === resource.price)?.label ?? resource.price ?? '';
1012

1113
const typesList = (resource.types || []).map((type) => {
@@ -23,7 +25,7 @@ const Resource = ({ resource }: { resource: IResource }) => {
2325

2426
return (
2527
<Card.Root key={resource.link}>
26-
{resource.logo && <Image src={`/resources/${resource.logo}`} px={6} pt={4} alt={`${resource.title} logo`} />}
28+
{resource.logo && <Image src={`${pagesBasePath}/resources/${resource.logo}`} px={6} pt={4} alt={`${resource.title} logo`} />}
2729

2830
<Card.Body gap="2">
2931
{!resource.logo && <Card.Title fontSize="2xl">{resource.title}</Card.Title> }

next.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
import type { NextConfig } from "next";
22

3+
const repoName = process.env.NEXT_PUBLIC_PAGES_BASE_PATH || '';
4+
35
const nextConfig: NextConfig = {
46
output: "export",
5-
basePath: process.env.PAGES_BASE_PATH,
7+
basePath: repoName,
8+
assetPrefix: repoName,
69
devIndicators: false,
710
experimental: {
811
optimizePackageImports: ["@chakra-ui/react"],

0 commit comments

Comments
 (0)