Skip to content

turns out that npm ci is needed in the docker container for mdx bundl… #24

turns out that npm ci is needed in the docker container for mdx bundl…

turns out that npm ci is needed in the docker container for mdx bundl… #24

name: Build 🏗️ and Deploy 🚀 to VPS
on:
workflow_dispatch:
push:
branches:
- main
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
name: Build
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Build distribution
run: npm run build --if-present
- uses: actions/upload-artifact@v4
with:
name: app-build
path: .output/
include-hidden-files: true
deploy:
runs-on: ubuntu-latest
name: Deploy to VPS
needs: build
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: app-build
path: ./.output
- uses: actions/checkout@v4
- name: Deploy to VPS
uses: appleboy/scp-action@v1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
source: "./.output,./src,./public,./mdx,./package.json,./package-lock.json,./vite.config.ts,./tsconfig.json,./nginx"
target: "~/sourcedepth.com/"
overwrite: true
- name: Build and restart Docker containers
uses: appleboy/ssh-action@v1
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
key: ${{ secrets.SSH_KEY }}
port: ${{ secrets.SSH_PORT }}
passphrase: ${{ secrets.SSH_PASSPHRASE }}
script: |
cd ~/sourcedepth.com
docker compose down
docker compose build --pull --no-cache
docker compose up -d
docker system prune -f