Skip to content

refactor: CD 스크립트 빌드 파일 업로드 경로 수정 #2

refactor: CD 스크립트 빌드 파일 업로드 경로 수정

refactor: CD 스크립트 빌드 파일 업로드 경로 수정 #2

Workflow file for this run

name: frontend-cd
on:
push:
# pull_request:
# types:
# - closed
# branches: ['develop']
# paths:
# - 'frontend/**'
defaults:
run:
working-directory: frontend
permissions:
contents: read
jobs:
build-and-upload:
# if: github.event.pull_request.merged == true
runs-on: ubuntu-22.04
steps:
- name: Set up Repository
uses: actions/checkout@v3
- name: Setup node with cache
uses: actions/setup-node@v3
with:
node-version: 18
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Install dependencies
run: npm ci
- name: Build App
run: npm run build
- name: Upload frontend build file to artifact
uses: actions/upload-artifact@v3
with:
name: FrontendApplication
path: frontend/dist
deploy:
needs: build-and-upload
runs-on: self-hosted
env:
DEV_DEPLOY_SCRIPT: ${{ secrets.DEV_FRONT_DEPLOY_SCRIPT }}
steps:
- name: Remove previous version app
working-directory: ./frontend/dev/
run: rm -rf dist
- name: Download build file from artifact
uses: actions/download-artifact@v3
with:
name: FrontendApplication
path: frontend/dev/dist
- name: Deploy to WAS
working-directory: ./frontend/dev/
run: |
echo "$DEV_DEPLOY_SCRIPT" > dev-deploy.sh
chmod 700 dev-deploy.sh
./dev-deploy.sh