Skip to content

Commit 7e3ceb5

Browse files
authored
Fix/deploy-issues (#41)
* chore: Update installation and cache actions in GitHub workflows * chore: Update installation and cache actions in GitHub workflows * chore: Fix if condition in GitHub workflows to compare string values * refactor: Optimize GameMusic component for better performance The GameMusic component has been refactored to improve performance. Instead of rendering the GameAudio component conditionally within a fragment, it now directly returns the GameAudio component if the 'music' prop is truthy, and returns null otherwise. This change reduces unnecessary rendering and improves the efficiency of the component. * chore: Remove deprecated code and environment variables This commit removes deprecated code and environment variables that are no longer used in the application. The `.env`, `.env.local`, and `.env.production` files have been updated to remove the `NEXT_PUBLIC_BASE` and `NEXT_PUBLIC_ANALYTICS` variables. Additionally, the `inter` font import in the `layout.tsx` file has been removed, as it is no longer needed. The `useTitle` hook in the `useTitle.tsx` file has been marked as deprecated and a comment has been added to suggest using Next.js metadata instead. Finally, the `base` property in the `environment.ts` file has been removed, as it is no longer used. * Update manifest.json path in index.html to fix broken link * chore: Update font import in layout.tsx for better performance This commit updates the font import in the layout.tsx file to improve performance. The deprecated 'inter' font import has been removed and replaced with a local font import using the 'next/font/local' package. This change reduces unnecessary network requests and improves the efficiency of the component.
1 parent e7576b6 commit 7e3ceb5

File tree

21 files changed

+92
-79
lines changed

21 files changed

+92
-79
lines changed

.env

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
NEXT_PUBLIC_BRAND_NAME=Tetromino
22
NEXT_PUBLIC_GITHUB=https://github.com/reactgular/tetromino
33
NEXT_PUBLIC_STORAGE_KEY=tetromino
4-
# Base path for loading audio files
5-
NEXT_PUBLIC_BASE=/tetromino
64
NEXT_PUBLIC_ANALYTICS=

.env.local

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
NEXT_PUBLIC_BASE=/
21
NEXT_PUBLIC_ANALYTICS=

.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# Please change to your Google Analytics ID
2-
NEXT_PUBLIC_ANALYTICS=UA-141015392-3
2+
NEXT_PUBLIC_ANALYTICS=

.github/actions/install/action.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: "📥 Install"
2+
description: "📥 Install dependencies"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: "💽 Restore node_modules cache"
8+
uses: actions/cache@v4
9+
id: cache-node-modules
10+
with:
11+
path: "node_modules"
12+
key: ${{ runner.os }}-${{ runner.arch }}-node-modules-${{ hashFiles('**/yarn.lock') }}
13+
restore-keys: |
14+
${{ runner.os }}-${{ runner.arch }}-node-modules-
15+
16+
- name: "📥 Install dependencies"
17+
if: ${{ steps.cache-node-modules.outputs.cache-hit != 'true' }}
18+
shell: bash
19+
run: yarn install --frozen-lockfile
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: "📥 NestJS cache"
2+
description: "📥 Cache NestJS dependencies"
3+
4+
runs:
5+
using: "composite"
6+
steps:
7+
- name: "💽 Restore .next/cache cache"
8+
uses: actions/cache@v4
9+
with:
10+
path: ${{ github.workspace }}/.next/cache
11+
key: ${{ runner.os }}-${{ runner.arch }}-nextjs-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js', '**/*.jsx', '**/*.ts', '**/*.tsx') }}
12+
restore-keys: |
13+
${{ runner.os }}-${{ runner.arch }}-nextjs-${{ hashFiles('**/yarn.lock') }}-

.github/workflows/build.yml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,7 @@ jobs:
3131
cache: "yarn"
3232

3333
- name: "📦 Install dependencies"
34-
uses: reactgular/cache@v1
35-
with:
36-
mode: "install"
34+
uses: ./.github/actions/install
3735

3836
lint:
3937
runs-on: ubuntu-latest
@@ -48,10 +46,8 @@ jobs:
4846
node-version: "20"
4947
cache: "yarn"
5048

51-
- name: "💽 Restore node_modules cache"
52-
uses: reactgular/cache@v1
53-
with:
54-
mode: "restore"
49+
- name: "📦 Install dependencies"
50+
uses: ./.github/actions/install
5551

5652
- name: "🔨 Lint"
5753
run: yarn lint
@@ -70,10 +66,8 @@ jobs:
7066
node-version: "20"
7167
cache: "yarn"
7268

73-
- name: "💽 Restore node_modules cache"
74-
uses: reactgular/cache@v1
75-
with:
76-
mode: "restore"
69+
- name: "📦 Install dependencies"
70+
uses: ./.github/actions/install
7771

7872
- name: "🔨 Test"
7973
run: ${{ env.NX }} affected -t test
@@ -92,18 +86,16 @@ jobs:
9286
node-version: "20"
9387
cache: "yarn"
9488

95-
- name: "💽 Restore node_modules cache"
96-
uses: reactgular/cache@main
97-
with:
98-
mode: "restore"
89+
- name: "📦 Install dependencies"
90+
uses: ./.github/actions/install
9991

10092
- name: "🔨 Build storybooks"
10193
run: yarn build-storybook
10294

10395
build:
10496
runs-on: ubuntu-latest
10597
needs: [ install ]
106-
if: ${{ github.event.inputs.testOnly == false }}
98+
if: ${{ github.event.inputs.testOnly == 'false' }}
10799
steps:
108100
- name: "📥 Checkout code"
109101
uses: actions/checkout@v4
@@ -114,10 +106,11 @@ jobs:
114106
node-version: "20"
115107
cache: "yarn"
116108

117-
- name: "💽 Restore node_modules cache"
118-
uses: reactgular/cache@v1
119-
with:
120-
mode: "restore"
109+
- name: "📦 Install dependencies"
110+
uses: ./.github/actions/install
111+
112+
- name: "💽 Restore .next/cache cache"
113+
uses: ./.github/actions/next-cache
121114

122115
- name: "🔨 Build"
123116
run: yarn build

.github/workflows/deploy.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ jobs:
3636
node-version: "20"
3737
cache: "yarn"
3838

39-
- name: "💽 Restore node_modules cache"
40-
uses: reactgular/cache@v1
41-
with:
42-
mode: "restore"
39+
- name: "📦 Install dependencies"
40+
uses: ./.github/actions/install
41+
42+
- name: "💽 Restore .next/cache cache"
43+
uses: ./.github/actions/next-cache
4344

4445
- name: "🔧 Setup Pages"
4546
uses: actions/configure-pages@v5
@@ -63,7 +64,7 @@ jobs:
6364
url: ${{ steps.deployment.outputs.page_url }}
6465
runs-on: ubuntu-latest
6566
needs: [ artifacts ]
66-
if: ${{ github.event.inputs.skipDeploy == false }}
67+
if: ${{ github.event.inputs.skipDeploy == 'false' }}
6768
steps:
6869
- name: "🚀 Deploy to GitHub Pages"
6970
id: deployment

old/public/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
manifest.json provides metadata used when your web app is installed on a
1515
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
1616
-->
17-
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
17+
<link rel="manifest" href="%PUBLIC_URL%/src/app/manifest.json" />
1818
<!--
1919
Notice the use of %PUBLIC_URL% in the tags above.
2020
It will be replaced with the URL of the `public` folder during the build.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)