ci: ✨ add action to build and deploy automatically upon push
Some checks failed
Build and Deploy NPM Project to Webserver via SSH / build-and-deploy (push) Failing after 45s
Some checks failed
Build and Deploy NPM Project to Webserver via SSH / build-and-deploy (push) Failing after 45s
This commit is contained in:
parent
170f3c6b53
commit
3ed5d868d5
1 changed files with 35 additions and 0 deletions
35
.forgejo/workflows/deploy.yaml
Normal file
35
.forgejo/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
name: Build and Deploy NPM Project to Webserver via SSH
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-deploy:
|
||||||
|
runs-on: docker
|
||||||
|
|
||||||
|
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
|
||||||
|
run: |
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > private_key
|
||||||
|
chmod 600 private_key
|
||||||
|
|
||||||
|
echo "Deploying via SCP..."
|
||||||
|
scp -i private_key -r public/* ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_HOST }}:/mnt/user/appdata/sebin-blog/www
|
||||||
|
|
||||||
|
rm -f private_key
|
Loading…
Add table
Add a link
Reference in a new issue