Files

65 lines
1.6 KiB
YAML

name: Build and Deploy
on:
push:
branches: [main]
workflow_dispatch:
permissions:
contents: read
pages: write
id-token: write
jobs:
build:
runs-on: ubuntu-latest
outputs:
pages_ready: ${{ steps.configure-pages.outcome == 'success' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
- name: Setup Pages
uses: actions/configure-pages@v5
id: configure-pages
continue-on-error: true
with:
static_site_generator: next
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Build with Next.js
run: bun run build
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.configure-pages.outputs.base_path || '' }}
NEXT_PUBLIC_DATA_URL: ${{ vars.DATA_PATH || '/entdb-data' }}
- name: Upload artifact
if: steps.configure-pages.outcome == 'success'
uses: actions/upload-pages-artifact@v3
with:
path: ./out
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
if: >-
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 == 'repository_dispatch')
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4