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
70 changes: 42 additions & 28 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# Sample workflow for building and deploying a Jekyll site to GitHub Pages
# This workflow builds and deploys a Vite site to GitHub Pages
name: Deploy Vite site to Pages

on:
# Runs on pushes targeting the default branch
# Runs on pushes to master and version branches
push:
branches: ["master"]
branches: ["master", "v1", "v2", "v3", "v4", "v5"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

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

Expand All @@ -27,39 +22,58 @@ concurrency:
cancel-in-progress: false

jobs:
# Build job
build:
build-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'

- name: Install dependencies
run: npm ci
- name: Setup Pages
id: pages
uses: actions/configure-pages@v5

- name: Build with Vite
run: npm run build
env:
NODE_ENV: production
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
VITE_BASE_PATH: ${{ github.ref_name == 'master' && '/' || format('/{0}/', github.ref_name) }}

# Add these debug steps:
- name: Debug - Show branch and base path
run: |
echo "Branch: ${{ github.ref_name }}"
echo "Base path: ${{ github.ref_name == 'master' && '/' || format('/{0}/', github.ref_name) }}"

- name: Debug - List dist contents
run: |
echo "Contents of dist directory:"
ls -la dist/
echo "File count:"
find dist -type f | wc -l

- name: Debug - Show destination
run: |
echo "Destination directory: ${{ steps.destination.outputs.dir }}"

- name: Set destination directory
id: destination
run: |
if [ "${{ github.ref_name }}" == "master" ]; then
echo "dir=" >> $GITHUB_OUTPUT
else
echo "dir=${{ github.ref_name }}" >> $GITHUB_OUTPUT
fi

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist
destination_dir: ${{ steps.destination.outputs.dir }}
keep_files: true
force_orphan: false
1 change: 1 addition & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import tailwindcss from "@tailwindcss/vite";

// https://vite.dev/config/
export default defineConfig({
base: process.env.VITE_BASE_PATH || '/',
plugins: [
react(),
tailwindcss()
Expand Down