From ad1db7c802f3037f8b9ca1cd6826311b7a07926f Mon Sep 17 00:00:00 2001 From: luantran Date: Thu, 18 Dec 2025 01:59:53 -0500 Subject: [PATCH 1/3] added versioning --- .github/workflows/deploy.yml | 50 +++++++++++++++++------------------- vite.config.js | 1 + 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index fc9fcf0..eef47da 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,15 +1,10 @@ -# 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: @@ -27,39 +22,40 @@ 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) }} + + - 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 \ No newline at end of file diff --git a/vite.config.js b/vite.config.js index 7645c34..2413608 100644 --- a/vite.config.js +++ b/vite.config.js @@ -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() From 00063153b0934fb54f39fb27c17c19b7d05af5d2 Mon Sep 17 00:00:00 2001 From: luantran Date: Thu, 18 Dec 2025 02:02:49 -0500 Subject: [PATCH 2/3] added versioning fix --- .github/workflows/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index eef47da..c1d86e0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,7 +11,7 @@ on: # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages permissions: - contents: read + contents: write pages: write id-token: write From ca586b3decfecf5aa37441a0596a17de124930df Mon Sep 17 00:00:00 2001 From: luantran Date: Thu, 18 Dec 2025 02:13:04 -0500 Subject: [PATCH 3/3] added versioning fix --- .github/workflows/deploy.yml | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c1d86e0..292642d 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -43,6 +43,23 @@ jobs: NODE_ENV: production 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: | @@ -58,4 +75,5 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./dist destination_dir: ${{ steps.destination.outputs.dir }} - keep_files: true \ No newline at end of file + keep_files: true + force_orphan: false \ No newline at end of file