Skip to content

feat: add github workflow #12

feat: add github workflow

feat: add github workflow #12

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
- uses: actions/upload-artifact@v4
with:
name: dist
path: dist
- uses: actions/download-artifact@v4
with:
name: dist
path: dist
- name: ssh
run: |
apt-get -yq update
apt-get -yqq install ssh
install -m 600 -D /dev/null ~/.ssh/id_rsa
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
ssh-keyscan $SSH_HOST > ~/.ssh/known_hosts
ssh $SSH_USER@$SSH_HOST
# - name: Copy dist folder over ssh
# uses: appleboy/scp-action@master
# with:
# host: ${{ secrets.SSH_HOST }}
# username: ${{ secrets.SSH_USER }}
# port: 22
# key: ${{ secrets.DEPLOY_KEY }}
# source: 'dist/*'
# target: '/var/www/html'