Some checks failed
Build and Deploy Node App / build-and-deploy (push) Has been cancelled
63 lines
1.7 KiB
YAML
63 lines
1.7 KiB
YAML
name: Build and Deploy Node App
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
|
|
jobs:
|
|
build-and-deploy:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Setup Node.js and pnpm
|
|
run: |
|
|
apk add --no-cache nodejs npm
|
|
npm install -g pnpm
|
|
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Cache pnpm store
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ~/.local/share/pnpm/store/v3
|
|
# Link cache to existing lockfile
|
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-pnpm-
|
|
|
|
- name: Install and Build
|
|
run: |
|
|
pnpm install
|
|
pnpm run build
|
|
|
|
# 5. DEPLOY TO STAGING
|
|
- name: Deploy to DEV (Builder)
|
|
if: github.ref == 'refs/heads/dev'
|
|
run: |
|
|
rm -rf /mnt/builder/*
|
|
|
|
# Change 'dist/*' below based on your framework:
|
|
# 👉 Vite (React, Vue), Astro: cp -r dist/*
|
|
# 👉 Create React App, SvelteKit: cp -r build/*
|
|
# 👉 Next.js (Static Export): cp -r out/*
|
|
|
|
cp -r dist/* /mnt/builder/
|
|
|
|
echo "🚀 Deployed to Dev: https://builder.pynixworld.com"
|
|
|
|
# 6. DEPLOY TO PRODUCTION
|
|
- name: Deploy to PROD (WWW)
|
|
if: github.ref == 'refs/heads/main'
|
|
run: |
|
|
rm -rf /mnt/prod/*
|
|
|
|
# Change 'dist/*' below based on your framework:
|
|
# 👉 Vite (React, Vue), Astro: cp -r dist/*
|
|
# 👉 Create React App, SvelteKit: cp -r build/*
|
|
# 👉 Next.js (Static Export): cp -r out/*
|
|
|
|
cp -r dist/* /mnt/prod/
|
|
|
|
echo "🚀 Deployed to Prod: https://www.pynixworld.com"
|