This commit is contained in:
parent
c7026aa3d8
commit
45b38a85bb
40
.forgejo/workflows/deploy.yml
Normal file
40
.forgejo/workflows/deploy.yml
Normal file
|
@ -0,0 +1,40 @@
|
|||
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/
|
Loading…
Reference in a new issue