Skip to content

Commit 6fc987a

Browse files
authored
Merge pull request #208 from vechain/fix-preview-env
Fix preview environment deployments
2 parents 7e346bc + 6792b58 commit 6fc987a

File tree

5 files changed

+17
-15
lines changed

5 files changed

+17
-15
lines changed

.github/workflows/deploy-cloudfront.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
build-and-deploy:
2424
runs-on: ubuntu-latest
2525
env:
26-
BASE_PATH: ''
26+
NEXT_PUBLIC_BASE_PATH: ''
2727
NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID }}
2828
NEXT_PUBLIC_PRIVY_APP_ID: ${{ secrets.NEXT_PUBLIC_PRIVY_APP_ID }}
2929
NEXT_PUBLIC_PRIVY_CLIENT_ID: ${{ secrets.NEXT_PUBLIC_PRIVY_CLIENT_ID }}

.github/workflows/deploy-preview.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: |
3131
sanitized_branch_name=$(echo "${{ github.event.pull_request.head.ref }}" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9-]//g')
3232
echo "processedBranchName=$sanitized_branch_name" >> $GITHUB_OUTPUT
33-
echo "BASE_PATH=/$sanitized_branch_name" >> $GITHUB_ENV
33+
echo "NEXT_PUBLIC_BASE_PATH=/$sanitized_branch_name" >> $GITHUB_ENV
3434
3535
- name: Build App
3636
env:
@@ -60,7 +60,7 @@ jobs:
6060
AWS_MAX_ATTEMPTS=10 aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_PREVIEW_CLOUDFRONT_DISTRIBUTION_ID }} --paths '/' '/*'
6161
6262
- name: Create Deployment Comment
63-
if: github.event.action == 'opened'
63+
if: github.event.action == 'opened' || github.event.action == 'reopened'
6464
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
6565
with:
6666
issue-number: ${{ github.event.pull_request.number }}

examples/homepage/next.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const basePath = process.env.BASE_PATH ?? '';
1+
const basePath = process.env.NEXT_PUBLIC_BASE_PATH ?? '';
22

33
/** @type {import('next').NextConfig} */
44
const nextConfig = {

examples/homepage/src/app/components/features/Introduction/Introduction.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import { FaSquareXTwitter } from 'react-icons/fa6';
2323

2424
export function Introduction() {
2525
const { connection } = useWallet();
26+
const basePath = process.env.basePath ?? '';
2627
return (
2728
<Box
2829
p={8}
@@ -142,42 +143,42 @@ export function Introduction() {
142143
<Icon as={SiFarcaster} boxSize={6} />
143144
<Icon as={FaApple} boxSize={6} />
144145
<Image
145-
src="/images/veworld-logo.png"
146+
src={`${basePath}/images/veworld-logo.png`}
146147
alt="VeWorld"
147148
height={6}
148149
width="auto"
149150
borderRadius="md"
150151
/>
151152
<Image
152-
src="/images/wallet-connect-logo.png"
153+
src={`${basePath}/images/wallet-connect-logo.png`}
153154
alt="WalletConnect"
154155
height={6}
155156
width="auto"
156157
borderRadius="md"
157158
/>
158159
<Image
159-
src="/images/rabby-logo.png"
160+
src={`${basePath}/images/rabby-logo.png`}
160161
alt="Rabby Wallet"
161162
height={6}
162163
width="auto"
163164
borderRadius="md"
164165
/>
165166
<Image
166-
src="/images/metamask-logo.png"
167+
src={`${basePath}/images/metamask-logo.png`}
167168
alt="MetaMask"
168169
height={6}
169170
width="auto"
170171
borderRadius="md"
171172
/>
172173
<Image
173-
src="/images/coinbase-wallet-logo.webp"
174+
src={`${basePath}/images/coinbase-wallet-logo.webp`}
174175
alt="Coinbase Wallet"
175176
height={6}
176177
width="auto"
177178
borderRadius="md"
178179
/>
179180
<Image
180-
src="/images/rainbow-logo.webp"
181+
src={`${basePath}/images/rainbow-logo.webp`}
181182
alt="Rainbow"
182183
height={6}
183184
width="auto"

examples/homepage/src/app/layout.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default function RootLayout({
2323
}: Readonly<{
2424
children: React.ReactNode;
2525
}>) {
26+
const basePath = process.env.basePath ?? '';
2627
return (
2728
<html
2829
lang="en"
@@ -41,15 +42,15 @@ export default function RootLayout({
4142
name="viewport"
4243
content="width=device-width, initial-scale=1.0"
4344
/>
44-
<link rel="icon" href="/images/logo.png" type="image/png" />
45+
<link rel="icon" href={`${basePath}/images/logo.png`} type="image/png" />
4546
<link
4647
rel="apple-touch-icon"
4748
sizes="57x57"
48-
href="/images/favicon/apple-touch-icon.png"
49+
href={`${basePath}/images/favicon/apple-touch-icon.png`}
4950
/>
5051
<meta
5152
name="msapplication-TileImage"
52-
content="/images/favicon/apple-touch-icon.png"
53+
content={`${basePath}/images/favicon/apple-touch-icon.png`}
5354
/>
5455

5556
{/* Open Graph Metadata */}
@@ -66,7 +67,7 @@ export default function RootLayout({
6667
<meta property="og:site_name" content="VeChain Kit" />
6768
<meta
6869
property="og:image"
69-
content="/images/vechain-kit-long.png"
70+
content={`${basePath}/images/vechain-kit-long.png`}
7071
/>
7172
<meta property="og:image:type" content="image/png" />
7273
<meta property="og:image:width" content="1200" />
@@ -82,7 +83,7 @@ export default function RootLayout({
8283
/>
8384
<meta
8485
name="twitter:image"
85-
content="/images/vechain-kit-long.png"
86+
content={`${basePath}/images/vechain-kit-long.png`}
8687
/>
8788
<meta name="twitter:image:alt" content="VeChain Kit" />
8889
</head>

0 commit comments

Comments
 (0)