Skip to content

Update main.yml

Update main.yml #151

Workflow file for this run

name: React Deploy
on:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: checkout master
uses: actions/checkout@v3
- name: cache node modules
uses: actions/[email protected]
with:
path: node_modules
key: ${{runner.OS}}-build-${{hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-build-
${{ runner.OS }}
- name: Install Dependencies
run: npm install
#Build : ./build 디렉토리에 폴더 생성
- name: Build
run: CI=false npm run build
#Deploy to server
- name: Deploy to Server
# uses: easingthemes/[email protected]
env:
# PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
# HOST: ${{ secrets.SERVER_HOST }}
# USERNAME: ${{ secrets.SERVER_USERNAME }}
# PORT: ${{ secrets.SERVER_PORT }}
# password: ${{ secrets.NPC_DEV_SERVER_PASSWORD }}
PRIVATE_KEY: ${{ secrets.NCP_PRI_KEY }}
HOST: ${{ secrets.NCP_HOST }}
USERNAME: ${{ secrets.NCP_USR_NM }}
PORT: ${{ secrets.NCP_PORT }}
password: ${{ secrets.NCP_USR_PWD }}
run: |
echo "$PRIVATE_KEY" > private_key.pem
chmod 400 private_key.pem
scp -i private_key.pem -P $PORT -o StrictHostKeyChecking=no -r build/ $USERNAME@$HOST:/var/www/html/
ssh -i private_key.pem -p $PORT -o StrictHostKeyChecking=no $USERNAME@$HOST 'bash -s' <<- EOF
rm -f private_key.pem