hotfix: d-day 수정 (#ect) #104
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: Deployment (Production) | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: prod | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: 'package.json' | |
- name: Retrive caches | |
uses: actions/cache@v4 | |
with: | |
path: node_modules | |
key: ${{ hashFiles('yarn.lock') }} | |
- name: Enable corepack | |
run: corepack enable | |
- name: Install project | |
run: yarn install --immutable | |
- name: Build | |
run: yarn build | |
env: | |
VITE_API_URL: ${{ vars.VITE_API_URL }} | |
VITE_REDIRECT_URI: ${{ vars.VITE_REDIRECT_URI }} | |
VITE_REST_API_KEY: ${{ secrets.VITE_REST_API_KEY }} | |
- name: Compress build artifacts | |
run: tar -cvf ./dist.tar ./dist | |
- name: Upload with SCP | |
uses: appleboy/scp-action@v0.1.7 | |
with: | |
username: ubuntu | |
host: ${{ secrets.SSH_HOST }} | |
key: ${{ secrets.SSH_KEY }} | |
source: "dist.tar" | |
target: "/home/ubuntu/" | |
- name: Extract artifact with SSH | |
uses: appleboy/ssh-action@v1.2.0 | |
with: | |
username: ubuntu | |
host: ${{ secrets.SSH_HOST }} | |
key: ${{ secrets.SSH_KEY }} | |
script: | | |
tar -xvf ./dist.tar ./dist | |
sudo rm -rf /var/www/homepage-frontend | |
sudo mv ./dist /var/www/homepage-frontend | |
rm -rf ./dist | |
rm -f ./dist.tar |