Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor/#518 frontend prod CD에 npm 캐시 추가 #520

Merged
merged 3 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/frontend-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,20 @@ jobs:
node-version: ${{ env.node-version }}

- name: Cache dependencies
id: cache
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
key: ${{ runner.os }}-node-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.cache-name }}-
${{ runner.os }}-node-
${{ runner.os }}-

- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: npm ci
working-directory: ${{ env.working-directory }}

Expand Down
1 change: 0 additions & 1 deletion .github/workflows/frontend-dev-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:
jobs:
build:
name: Frontend Develop Deploy

runs-on: shook-runner

steps:
Expand Down
33 changes: 25 additions & 8 deletions .github/workflows/frontend-prod-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,43 @@ jobs:

steps:
- name: Checkout Source Code
uses: actions/checkout@v2
uses: actions/checkout@v3
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 캐시 디팬던시를 사용하려면 v3를 사용해야하나용?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인입니다


- name: Setting env
shell: bash
run: |
rm -rf frontend/.env
mkdir frontend/.env
echo "BASE_URL=${{ secrets.FRONT_PROD_BASE_URL }}" > frontend/.env/.env.production
- name: Package clean install

- name: Cache dependencies
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ env.cache-name }}-
${{ runner.os }}-node-
${{ runner.os }}-
Comment on lines +30 to +33
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💬 무슨역할인가용?


- name: Install Dependencies
shell: bash
run: |
cd frontend
npm ci
if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
run: npm ci
working-directory: ./frontend

- name: Build files
shell: bash
run: |
cd frontend
npm run build
run: npm run build
working-directory: ./frontend

- name: Remove legacy static pages
shell: bash
run: rm -rf home/ubuntu/dist

- name: Move generated new static pages
shell: bash
run: cp -r frontend/dist ~/