Some checks are pending
Deploy to Server / deploy (push) Waiting to run
41 lines
955 B
YAML
41 lines
955 B
YAML
name: Deploy to Server
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: '20' # Adjust to your required Node.js version
|
|
|
|
- name: Install dependencies
|
|
run: npm install
|
|
|
|
- name: Build the project
|
|
run: npm run build
|
|
|
|
- name: Setup SSH key
|
|
env:
|
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
echo "$SSH_PRIVATE_KEY" > ~/.ssh/id_rsa
|
|
chmod 600 ~/.ssh/id_rsa
|
|
ssh-keyscan -H ${SSH_HOST} >> ~/.ssh/known_hosts
|
|
|
|
- name: Deploy to server
|
|
env:
|
|
SSH_USER: ${{ secrets.SSH_USER }}
|
|
SSH_HOST: ${{ secrets.SSH_HOST }}
|
|
run: |
|
|
scp -r ./out/* ${SSH_USER}@${SSH_HOST}:/var/www/litenet.tel/
|