Skip to content

feat: add github workflow #2

feat: add github workflow

feat: add github workflow #2

Workflow file for this run

name: Deploy to SSH Instance
on:
push:
branches: [main]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Install Vite dependencies
run: npm install
- name: Build React app
run: npm run build
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: build
path: dist
- name: Deploy to SSH Instance
uses: ssh-actions/ssh-run@v2
env:
DEPLOY_HOST: ${{ secrets.SSH_HOST }} # Replace with your SSH hostname
DEPLOY_USER: ${{ secrets.SSH_USER }} # Replace with your SSH username
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} # This secret stores your private key
TARGET_DIR: '/var/www/html' # Replace with your deployment directory
run: |
cd ${{ env.TARGET_DIR }}
wget https://actions.githubusercontent.com/workflows/downloads/.../$ARTIFACT_NAME-0.tar.gz # Replace with artifact download URL
tar -xvf $ARTIFACT_NAME-0.tar.gz