Make build workflow resilient when Pages is not configured

This commit is contained in:
codecolorist
2026-04-14 11:53:35 +00:00
parent 999b323bf8
commit 02ce7ac7e8
+8 -4
View File
@@ -17,6 +17,8 @@ permissions:
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs:
pages_ready: ${{ steps.configure-pages.outcome == 'success' }}
steps: steps:
- name: Checkout code - name: Checkout code
@@ -40,9 +42,9 @@ jobs:
- name: Setup Pages - name: Setup Pages
uses: actions/configure-pages@v5 uses: actions/configure-pages@v5
id: configure-pages id: configure-pages
continue-on-error: true
with: with:
static_site_generator: next static_site_generator: next
enablement: true
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
@@ -50,7 +52,7 @@ jobs:
- name: Build with Next.js - name: Build with Next.js
run: npm run build run: npm run build
env: env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.configure-pages.outputs.base_path }} NEXT_PUBLIC_BASE_PATH: ${{ steps.configure-pages.outputs.base_path || '' }}
- name: Download latest data release - name: Download latest data release
run: | run: |
@@ -67,6 +69,7 @@ jobs:
| xargs -r curl -L -o out/data/ent.db | xargs -r curl -L -o out/data/ent.db
- name: Upload artifact - name: Upload artifact
if: steps.configure-pages.outcome == 'success'
uses: actions/upload-pages-artifact@v3 uses: actions/upload-pages-artifact@v3
with: with:
path: ./out path: ./out
@@ -78,9 +81,10 @@ jobs:
needs: build needs: build
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: >- if: >-
(github.event_name == 'push' && github.ref == 'refs/heads/main') || needs.build.outputs.pages_ready == 'true' &&
((github.event_name == 'push' && github.ref == 'refs/heads/main') ||
(github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') ||
github.event_name == 'repository_dispatch' github.event_name == 'repository_dispatch')
steps: steps:
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages