fix: 견종정보 api 수정 #46
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 to Lightsail | |
on: | |
push: | |
branches: | |
- develop | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.11.1' | |
- name: Create .env file | |
run: | | |
echo '${{ secrets.ENV_FILE }}' > .env | |
- name: Install dependencies | |
run: yarn install | |
- name: Build the project | |
run: yarn build | |
- name: Archive production artifacts | |
run: tar -czf build.tar.gz dist node_modules .env | |
- name: Deploy to Lightsail | |
env: | |
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} | |
SSH_USERNAME: ${{ secrets.SSH_USERNAME }} | |
LIGHTSAIL_IP: ${{ secrets.LIGHTSAIL_IP }} | |
run: | | |
echo "$SSH_PRIVATE_KEY" > key.pem | |
chmod 600 key.pem | |
scp -o StrictHostKeyChecking=no -i key.pem build.tar.gz $SSH_USERNAME@$LIGHTSAIL_IP:~/build.tar.gz | |
ssh -o StrictHostKeyChecking=no -i key.pem $SSH_USERNAME@$LIGHTSAIL_IP << 'EOF' | |
cd ~/ | |
pm2 stop all || true | |
if [ -d dist ]; then rm -rf dist; fi | |
tar -xzf build.tar.gz | |
if [ -f build.tar.gz ]; then rm build.tar.gz; fi | |
pm2 start dist/main.js --env .env |