-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (47 loc) · 1.46 KB
/
Copy pathreact-basic-build.yml
File metadata and controls
56 lines (47 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: react build
on:
pull_request:
branches:
# - main
# - test
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
# 브랜치별 .env.production 생성
- name: Create .env.production file
run: |
if [ "${{ github.base_ref }}" = "main" ]; then
echo -e "${{ secrets.ENV_MAIN }}" > .env.production
elif [ "${{ github.base_ref }}" = "test" ]; then
echo -e "${{ secrets.ENV_TEST }}" > .env.production
else
echo -e "${{ secrets.ENV_MAIN }}" > .env.production
fi
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22.12.0"
cache: "npm"
- name: Cache npm dependencies
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Cache node_modules
id: node-modules-cache
uses: actions/cache@v4
with:
path: "**/node_modules"
key: ${{ runner.os }}-node-modules-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-modules-
- name: Install dependencies
if: steps.node-modules-cache.outputs.cache-hit != 'true'
run: npm ci
- name: Build project
run: npm run build