infra: create Forgejo deployment action using Docker
Some checks failed
Deploy site / deploy (push) Failing after 1m16s
Some checks failed
Deploy site / deploy (push) Failing after 1m16s
This commit is contained in:
parent
74461d37e1
commit
1cd575cfdb
2 changed files with 17 additions and 45 deletions
17
.forgejo/workflows/deploy.yaml
Normal file
17
.forgejo/workflows/deploy.yaml
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
name: Deploy site
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: node:18
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- run: npm install
|
||||||
|
- run: npm run build:posts
|
||||||
|
- run: npm run build
|
||||||
|
- run: |
|
||||||
|
cp -r dist/* /var/www/systemsobscure.blog/
|
||||||
|
chown -R www-data:www-data /var/www/systemsobscure.blog/
|
|
@ -1,45 +0,0 @@
|
||||||
name: Deploy Site
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Node.js
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: "18"
|
|
||||||
cache: "npm"
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: npm install
|
|
||||||
|
|
||||||
- name: Build posts
|
|
||||||
run: npm run build:posts
|
|
||||||
|
|
||||||
- name: Build project
|
|
||||||
run: npm run build
|
|
||||||
|
|
||||||
- name: Deploy to VPS
|
|
||||||
uses: appleboy/ssh-action@v0.1.5
|
|
||||||
with:
|
|
||||||
host: localhost # or localhost if connecting from the same VPS
|
|
||||||
username: ${{ secrets.VPS_USERNAME }}
|
|
||||||
key: ${{ secrets.VPS_SSH_KEY }}
|
|
||||||
script: |
|
|
||||||
rm -rf /var/www/systemsobscure.blog/*
|
|
||||||
|
|
||||||
- name: Copy files to VPS
|
|
||||||
uses: appleboy/scp-action@v0.1.4
|
|
||||||
with:
|
|
||||||
host: localhost # or localhost
|
|
||||||
username: ${{ secrets.VPS_USERNAME }}
|
|
||||||
key: ${{ secrets.VPS_SSH_KEY }}
|
|
||||||
source: "dist/*"
|
|
||||||
target: "/var/www/systemsobscure.blog/"
|
|
||||||
strip_components: 1
|
|
Loading…
Add table
Reference in a new issue