Merge pull request #52 from Likelion-YeungNam-Univ/feature/introPage #53
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: Continuous Deployment | |
on: | |
push: | |
branches: ['main'] | |
jobs: | |
deploy: | |
runs-on: ubuntu-20.04 | |
steps: | |
# 1. Compare branch 코드 내려 받기 | |
- name: Checkout PR | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.push.base_ref }} | |
- name: Create .env file | |
run: | | |
echo "REACT_APP_API_URL=${{ secrets.REACT_APP_API_URL }}" > .env | |
echo "REACT_APP_REST_API_KEY=${{ secrets.REACT_APP_REST_API_KEY }}" >> .env | |
echo "REACT_APP_REDIRECT_URI=${{ secrets.REACT_APP_REDIRECT_URI }}" >> .env | |
echo "REACT_APP_KAKAO_AUTH_URL=${{ secrets.REACT_APP_KAKAO_AUTH_URL }}" >> .env | |
# 3. Upload the .env file to the server | |
- name: Upload files to EC2 | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
port: ${{ secrets.SERVER_SSH_PORT }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_KEY }} | |
source: '.env' | |
target: '/home/ubuntu/12th-holing-web/.env' | |
# 2. SSH ACTION을 통한 Run-Command | |
- name: Deploy | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.SERVER_HOST }} | |
port: ${{ secrets.SERVER_SSH_PORT }} | |
username: ${{ secrets.SERVER_USERNAME }} | |
key: ${{ secrets.SERVER_KEY }} | |
script: | | |
cd /home/ubuntu/12th-holing-web/ | |
git pull origin main | |
npm install | |
npm run build | |
nohup npm start & |