Skip to content

Commit 715bf65

Browse files
committed
build: WORKING_DIRECTORY 환경 변수 추가 및 Next.js 캐시 경로 수정
1 parent 10b263c commit 715bf65

1 file changed

Lines changed: 15 additions & 29 deletions

File tree

.github/workflows/depoly-production.yml

Lines changed: 15 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ on:
99
env:
1010
AWS_REGION: ap-northeast-2
1111
AWS_S3_BUCKET_NAME: ${{ secrets.AWS_S3_BUCKET_NAME }}
12+
WORKING_DIRECTORY: ./mosu-app
1213

1314
jobs:
1415
build:
@@ -23,61 +24,46 @@ jobs:
2324
with:
2425
node-version: "22"
2526
cache: "yarn"
27+
cache-dependency-path: ${{ env.WORKING_DIRECTORY }}/yarn.lock
2628

27-
- name: Get yarn cache directory path
28-
id: yarn-cache-dir-path
29-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
30-
31-
- uses: actions/cache@v4
32-
id: nextjs-yarn-cache
29+
- name: Cache Next.js build
30+
uses: actions/cache@v4
3331
with:
34-
path: |
35-
${{ steps.yarn-cache-dir-path.outputs.dir }}
36-
${{ github.workspace }}/.next/cache
37-
key: ${{ runner.os }}-nextjs-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/*.js','**/*.jsx','**/*.ts','**/*.tsx') }}
32+
path: ${{ env.WORKING_DIRECTORY }}/.next/cache
33+
key: ${{ runner.os }}-nextjs-${{ hashFiles(format('{0}/yarn.lock', env.WORKING_DIRECTORY)) }}-${{ hashFiles(format('{0}/**/*.js', env.WORKING_DIRECTORY), format('{0}/**/*.tsx', env.WORKING_DIRECTORY)) }}
3834
restore-keys: |
39-
${{ runner.os }}-nextjs-yarn-${{ hashFiles('**/yarn.lock') }}-
35+
${{ runner.os }}-nextjs-${{ hashFiles(format('{0}/yarn.lock', env.WORKING_DIRECTORY)) }}-
4036
4137
- name: Install dependencies
4238
run: yarn install --frozen-lockfile
43-
working-directory: ./mosu-app
39+
working-directory: ${{ env.WORKING_DIRECTORY }}
4440

4541
- name: Build Application
4642
run: yarn build
47-
working-directory: ./mosu-app
43+
working-directory: ${{ env.WORKING_DIRECTORY }}
4844

49-
- name: List build output (debug)
45+
- name: List build output (for debugging)
5046
run: |
51-
echo "Listing mosu-app directory:"
52-
ls -la mosu-app/
53-
echo "Checking if .next exists:"
54-
if [ -d "mosu-app/.next" ]; then
55-
echo ".next directory exists"
56-
ls -la mosu-app/.next/
57-
echo "Working directory:"
58-
pwd
59-
echo "Full path check:"
60-
ls -la ./mosu-app/.next/
61-
else
62-
echo ".next directory does not exist"
63-
fi
47+
echo "Listing contents of ${{ env.WORKING_DIRECTORY }}/.next directory:"
48+
ls -la ${{ env.WORKING_DIRECTORY }}/.next
6449
6550
- name: Upload Build Artifacts (.next)
6651
uses: actions/upload-artifact@v4
6752
with:
6853
name: mosu-app-build
69-
path: mosu-app/.next/
54+
path: ${{ env.WORKING_DIRECTORY }}/.next/
7055
if-no-files-found: error
7156

7257
- name: Upload Public Directory
7358
uses: actions/upload-artifact@v4
7459
with:
7560
name: mosu-app-public
76-
path: mosu-app/public/
61+
path: ${{ env.WORKING_DIRECTORY }}/public/
7762
if-no-files-found: error
7863

7964
approve:
8065
name: Await for Approval
66+
needs: build
8167
runs-on: ubuntu-latest
8268
environment: production
8369
steps:

0 commit comments

Comments
 (0)