Skip to content

fix: git checkout before pulling #5

fix: git checkout before pulling

fix: git checkout before pulling #5

Workflow file for this run

name: Deploy to VPS
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build_and_deploy:
# The type of runner that the job will run on
name: Build and Deploy
runs-on: ubuntu-latest
environment: production
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Build and Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: ${{ secrets.SSH_PORT }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
sudo pm2 stop ${{ secrets.PM2_APP_NAME }} -s
cd ${{ secrets.APP_PATH }}
git checkout .
git pull origin master
yarn build --silent
sudo pm2 start ${{ secrets.PM2_APP_NAME }} -s