infra: 배포 스크립트 수정 #48
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: deploy | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- prod/frontend | |
jobs: | |
build: | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Add Enviromnet | |
run: | | |
cd frontend | |
touch .env | |
echo "${{ secrets.GOOGLE_MAPS_API_KEY }}" >> .env | |
- name: Set up Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18.16.0 | |
- name: Install dependencies | |
run: npm install | |
- name: Cache node_modules | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Build | |
run: npm run build | |
- name: Upload build files | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Prod | |
path: frontend/dist | |
deploy: | |
needs: build | |
runs-on: self-hosted | |
steps: | |
- name: Download the built file to AWS | |
uses: actions/download-artifact@v3 | |
with: | |
name: Prod | |
path: frontend/prod/dist |