Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 23 additions & 33 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,31 +1,20 @@
# Sample workflow for building and deploying a Next.js site to GitHub Pages
#
# To get started with Next.js see: https://nextjs.org/docs/getting-started
#
name: Deploy Next.js site to Pages
name: Multi-Tier Deployment

on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]

# Allows you to run this workflow manually from the Actions tab
branches: ["main", "dev"]
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
Expand All @@ -40,16 +29,6 @@ jobs:
echo "command=ci" >> $GITHUB_OUTPUT
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
echo "manager=yarn" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=yarn" >> $GITHUB_OUTPUT
exit 0
elif [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
echo "manager=pnpm" >> $GITHUB_OUTPUT
echo "command=install" >> $GITHUB_OUTPUT
echo "runner=pnpm" >> $GITHUB_OUTPUT
exit 0
else
echo "Unable to determine package manager"
exit 1
Expand All @@ -62,12 +41,9 @@ jobs:
cache: ${{ steps.detect-package-manager.outputs.manager }}

- name: Setup Pages
if: github.ref == 'refs/heads/dev'
uses: actions/configure-pages@v5
with:
# Automatically inject basePath in your Next.js configuration file and disable
# server side image optimization (https://nextjs.org/docs/api-reference/next/image#unoptimized).
#
# You may remove this line if you want to manage the configuration yourself.
static_site_generator: next

- name: Install dependencies
Expand All @@ -78,17 +54,31 @@ jobs:
working-directory: ./apps/web
env:
NODE_ENV: production
BASE_PATH: /RestroFX
NEXT_PUBLIC_BASE_PATH: /RestroFX
ASSET_PREFIX: /RestroFX/
BASE_PATH: ${{ github.ref == 'refs/heads/dev' && '/RestroFX' || '' }}
NEXT_PUBLIC_BASE_PATH: ${{ github.ref == 'refs/heads/dev' && '/RestroFX' || '' }}
ASSET_PREFIX: ${{ github.ref == 'refs/heads/dev' && '/RestroFX/' || '' }}

- name: Upload artifact
- name: Upload GitHub Pages artifact
if: github.ref == 'refs/heads/dev'
uses: actions/upload-pages-artifact@v3
with:
path: ./apps/web/out

# Deployment job
deploy:
- name: Deploy to Hostinger
if: github.ref == 'refs/heads/main'
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rlgoDzvc -i"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
REMOTE_PORT: ${{ secrets.REMOTE_PORT }}
SOURCE: "apps/web/out/"
TARGET: "public_html/"
EXCLUDE: "/dist/, /node_modules/"

deploy-github-pages:
if: github.ref == 'refs/heads/dev'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
6 changes: 3 additions & 3 deletions apps/web/next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ const nextConfig = {
output: 'export',
// basePath for GitHub Pages - will be overridden by GitHub Actions if it injects it
// Set explicitly for production builds to ensure it's available during build
basePath: process.env.BASE_PATH || (process.env.NODE_ENV === 'production' ? '/RestroFX' : ''),
basePath: process.env.BASE_PATH || '',
trailingSlash: true,
// assetPrefix must match basePath (with trailing slash) for GitHub Pages
// assetPrefix must match basePath (with trailing slash)
// This ensures CSS, JS, and other assets load correctly
assetPrefix: process.env.ASSET_PREFIX || (process.env.NODE_ENV === 'production' ? '/RestroFX/' : ''),
assetPrefix: process.env.ASSET_PREFIX || '',
transpilePackages: ["@crimsonfx/ui", "@crimsonfx/utils", "@crimsonfx/types"],
images: {
unoptimized: true,
Expand Down