Skip to content

Commit

Permalink
chore: cd 스크립트 작성 #457
Browse files Browse the repository at this point in the history
  • Loading branch information
rbgksqkr committed Jan 5, 2025
1 parent fcef643 commit 1588f54
Showing 1 changed file with 62 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/fe-cd-admin.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: FE Build for admin

on:
push:
branches: ["main", "develop"]
paths:
- "frontend-admin/**"

jobs:
build-and-test:
runs-on: ubuntu-latest

defaults:
run:
working-directory: ./frontend-admin

steps:
- uses: actions/checkout@v4

- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
cache-dependency-path: frontend-admin/pnpm-lock.yaml

- name: Generate .env File
working-directory: ./frontend
run: |
echo "API_BASE_URL=${{ secrets.API_BASE_URL_PROD }}" >> .env
- name: Install Dependencies
run: npm install
working-directory: ./frontend-admin

- name: Cache node_modules
id: cache
uses: actions/cache@v3
with:
path: "**/node_modules"
key: ${{ runner.os }}-node-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-node-
- name: Build
run: pnpm build
working-directory: ./frontend-admin

- name: Configure AWS CLI
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set default.region ${{ secrets.AWS_REGION }}
- name: Upload to S3 (Admin)
working-directory: ./frontend-admin/dist
run: |
aws s3 sync . s3://${{ secrets.AWS_S3_BUCKET_ADMIN }} --delete
- name: Invalidate CloudFront Cache (Admin)
run: |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DISTRIBUTION_ID_ADMIN }} --paths "/*"

0 comments on commit 1588f54

Please sign in to comment.