50 lines
1.2 KiB
YAML
50 lines
1.2 KiB
YAML
name: Deploy React Vite App
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
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: '16'
|
|
#
|
|
# # - name: Install build tools
|
|
# # run: sudo apt-get install -y build-essential
|
|
#
|
|
# #- name: List node_modules
|
|
# # run: ls -R node_modules
|
|
#
|
|
# - name: Install dependencies
|
|
# run: npm ci --production=True
|
|
# # or npm ci
|
|
#
|
|
# - name: Build the app
|
|
# run: npm run build
|
|
|
|
- name: Deploy to VPS
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
VPS_USER: ${{ secrets.SSH_USERNAME }}
|
|
VPS_HOST: ${{ secrets.SSH_HOST }}
|
|
VPS_PORT: ${{ secrets.SSH_PORT }}
|
|
VPS_PATH: ${{ secrets.PATH}}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H $VPS_HOST >> ~/.ssh/known_hosts
|
|
# rsync -avz $VPS_USER@$VPS_HOST $VPS_PATH
|
|
# --delete dist/
|
|
ssh $VPS_USER@$VPS_HOST -p $VPS_PORT "cd $VPS_PATH && touch t.txt
|
|
# && npm install --production"
|
|
# && pm2 restart all"
|