deploying next to a VPS + static files to a cdn

im deploying a next app to a VPS using github action and in my next config ts im adding the output: standalone as mentionned in the doc it will generate a minimal build that i export to the vps and they let you handle the assests and public to deploy them to a cdn my question is how can i deploy only the static files to the cdn from the github actions here is my ci im running for the deployement on vps
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

steps:
- name: 📥 Checkout repository
uses: actions/checkout@v3

- name: ⚙️ Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: 🍞 Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: 📦 Install dependencies w/bun
run: bun install --frozen-lockfile
- name: 🏗️ Build for production
run: npm run build

- name: 📂 Copy dist to VPS
uses: appleboy/scp-action@master
with:
host: ${{ vars.HOST }}
username: ${{ vars.USERNAME }}
key: ${{ vars.PRIVATE_KEY }}
port: 22
source: "next.config.js,node_modules,.next,package.json,.env,public,ecosystem.json"
target: "~/jozdan-app"

- name: 🚀 Deploy to server using SSH
uses: appleboy/ssh-action@master
with:
host: ${{ vars.HOST }}
username: ${{ vars.USERNAME }}
key: ${{ vars.PRIVATE_KEY }}
port: 22
script: |
pm2 restart jozdan-app
pm2 save
sudo systemctl restart nginx
on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]

steps:
- name: 📥 Checkout repository
uses: actions/checkout@v3

- name: ⚙️ Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: 🍞 Setup bun
uses: oven-sh/setup-bun@v1
with:
bun-version: latest
- name: 📦 Install dependencies w/bun
run: bun install --frozen-lockfile
- name: 🏗️ Build for production
run: npm run build

- name: 📂 Copy dist to VPS
uses: appleboy/scp-action@master
with:
host: ${{ vars.HOST }}
username: ${{ vars.USERNAME }}
key: ${{ vars.PRIVATE_KEY }}
port: 22
source: "next.config.js,node_modules,.next,package.json,.env,public,ecosystem.json"
target: "~/jozdan-app"

- name: 🚀 Deploy to server using SSH
uses: appleboy/ssh-action@master
with:
host: ${{ vars.HOST }}
username: ${{ vars.USERNAME }}
key: ${{ vars.PRIVATE_KEY }}
port: 22
script: |
pm2 restart jozdan-app
pm2 save
sudo systemctl restart nginx
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server