ci: ✨ add action to build and deploy automatically upon push
Some checks are pending
Build and Deploy NPM Project to Webserver via SSH / build-and-deploy (push) Waiting to run
Some checks are pending
Build and Deploy NPM Project to Webserver via SSH / build-and-deploy (push) Waiting to run
This commit is contained in:
parent
170f3c6b53
commit
6b696a1281
1 changed files with 39 additions and 0 deletions
39
.forgejo/workflows/deploy.yaml
Normal file
39
.forgejo/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
name: Build and Deploy NPM Project to Webserver via SSH
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Set up Node.js
|
||||||
|
uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: '22'
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm install
|
||||||
|
|
||||||
|
- name: Build Project
|
||||||
|
run: npm run build
|
||||||
|
|
||||||
|
- name: Deploy via SCP
|
||||||
|
env:
|
||||||
|
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||||
|
REMOTE_USER: ${{ secrets.REMOTE_USER }}
|
||||||
|
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
|
||||||
|
run: |
|
||||||
|
echo "$SSH_PRIVATE_KEY" > private_key
|
||||||
|
chmod 600 private_key
|
||||||
|
|
||||||
|
echo "Deploying via SCP to $REMOTE_USER@$REMOTE_HOST..."
|
||||||
|
scp -i private_key -r public/* $REMOTE_USER@$REMOTE_HOST:/mnt/user/appdata/sebin-blog/www
|
||||||
|
|
||||||
|
rm -f private_key
|
Loading…
Add table
Add a link
Reference in a new issue