Skip to content

Commit

Permalink
test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Andcool-Systems committed Jul 28, 2024
1 parent 11f8201 commit 312892c
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,26 +1,44 @@
name: Deploy to Server
name: Check and Deploy to Server

on:
push:
branches:
- master

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: "20"

- name: Install dependencies
run: npm install

- name: Run build
run: npm run build

deploy:
runs-on: ubuntu-latest
needs: build

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install SSH and SCP
run: sudo apt-get update && sudo apt-get install -y openssh-client
run: sudo apt-get update && sudo apt-get install -y openssh-client sshpass

- name: Copy files via SCP
env:
SSHPASS: ${{ secrets.ROOT_SSH_PASSWORD }}
run: |
sudo apt-get install -y sshpass
sshpass -e scp -o StrictHostKeyChecking=no -r ./* root@${{ secrets.SERVER_IP }}:/home/ppl_site
- name: Execute remote commands
Expand All @@ -29,6 +47,7 @@ jobs:
run: |
sshpass -e ssh -o StrictHostKeyChecking=no root@${{ secrets.SERVER_IP }} << 'EOF'
cd /home/ppl_site
npm install
npm run build
systemctl restart ppl_site
EOF

0 comments on commit 312892c

Please sign in to comment.