From b0a7591da0ba74f2a4112a7d2398f785dc4db5b8 Mon Sep 17 00:00:00 2001 From: Denis Davydkov Date: Thu, 26 Oct 2023 05:06:48 +0200 Subject: [PATCH] handle custom base --- .github/workflows/pages.yml | 13 +++++++++---- package.json | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml index dd89a62..5eff4b4 100644 --- a/.github/workflows/pages.yml +++ b/.github/workflows/pages.yml @@ -23,7 +23,7 @@ concurrency: jobs: # Build job - build: + build-pages: runs-on: ubuntu-latest steps: - name: Checkout @@ -33,23 +33,28 @@ jobs: with: node-version: "20" - name: Setup Pages + id: pages uses: actions/configure-pages@v3 - name: Install dependencies run: npm install - name: Build - run: npm run build + run: npx likec4 build -o ./dist --base "${{ steps.pages.outputs.base_path }}" + # GitHub Pages doesn't allow to configure routing for single page apps, + # So we copy index.html to 404.html to make it work + - name: Custom 404 page + run: cp ./dist/index.html ./dist/404.html - name: Upload artifact uses: actions/upload-pages-artifact@v2 with: path: ./dist # Deployment job - deploy: + deploy-pages: environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest - needs: build + needs: build-pages steps: - name: Deploy to GitHub Pages id: deployment diff --git a/package.json b/package.json index 4c77b4c..6c24bb0 100644 --- a/package.json +++ b/package.json @@ -6,7 +6,7 @@ "scripts": { "start": "likec4 serve", "dev": "likec4 serve", - "build": "likec4 build -o ./dist", + "build": "likec4 build", "export:png": "likec4 export png -o ./png" }, "devDependencies": {