Skip to content

update ssh command after deploying #4

update ssh command after deploying

update ssh command after deploying #4

Workflow file for this run

name: πŸš€ Deploy website on push
on:
push:
branches:
- main # Change this to your default branch if different
jobs:
web-deploy:
name: πŸŽ‰ Deploy
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the latest code
- name: 🚚 Get latest code
uses: actions/checkout@v4
# Step 2: Install Node.js 20 (updated to the latest version)
- name: Use Node.js 20
uses: actions/setup-node@v3
with:
node-version: "20"
# Step 3: Sync files to the server via FTP (Upload all files to /home/tbtouris/api)
- name: πŸ“‚ Sync files
uses: SamKirkland/FTP-Deploy-Action@v4.3.5
with:
server: ${{ vars.FTP_SERVER }} # Add this secret in your GitHub repository settings
username: ${{ vars.FTP_USERNAME }} # Add this secret
password: ${{ vars.FTP_PASSWORD }} # Add this secret
local-dir: ./ # All root files will be uploaded
server-dir: /home/tbtouris/api/ # Server directory path
protocol: ftps # Use ftps for a secure connection
exclude: | # Exclude unnecessary files
**/.git*
**/.git*/**
**/node_modules/**
**/frontend/node_modules/**
**/backend/node_modules/**
# Step 4: Install dependencies and build the project on the server using a custom SSH port
- name: πŸ”§ Install and Build on Server
run: |
sshpass -p "${{ secrets.SSH_PASSWORD }}" ssh -T -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} << 'EOF'
cd /home/tbtouris/api

Check failure on line 45 in .github/workflows/main.yaml

View workflow run for this annotation

GitHub Actions / .github/workflows/main.yaml

Invalid workflow file

You have an error in your yaml syntax on line 45
npm install
npm run build
EOF
env:
SSH_PASSWORD: ${{ vars.SSH_PASSWORD }}
SSH_USER: ${{ vars.SSH_USER }}
SSH_HOST: ${{ vars.SSH_HOST }}
SSH_PORT: ${{ vars.SSH_PORT }}