Skip to content

Update frontend to AGI theme and fix image loading #1

Update frontend to AGI theme and fix image loading

Update frontend to AGI theme and fix image loading #1

Workflow file for this run

name: PR Preview
on:
pull_request:
types: [opened, synchronize, reopened, closed]
permissions:
contents: write
pull-requests: write
concurrency: preview-${{ github.ref }}
jobs:
build-preview:
if: github.event.action != 'closed'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
lfs: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: frontend/package-lock.json
- name: Install dependencies
working-directory: frontend
run: npm ci
- name: Copy static assets
working-directory: frontend
run: |
mkdir -p public/thumbnails public/downsampled public/annotations/nsd
cp -r ../data/thumbnails/* public/thumbnails/ 2>/dev/null || echo "No thumbnails to copy"
cp -r ../images/downsampled/* public/downsampled/ 2>/dev/null || echo "No images to copy"
cp -r ../annotations/nsd/*.json public/annotations/nsd/ 2>/dev/null || echo "No annotations to copy"
- name: Build Next.js site
working-directory: frontend
env:
# Set base path for PR preview subdirectory
NEXT_PUBLIC_BASE_PATH: /image-annotation/pr-preview/pr-${{ github.event.number }}
run: |
# Update next.config.js base path for preview
sed -i "s|'/image-annotation'|'/image-annotation/pr-preview/pr-${{ github.event.number }}'|g" next.config.js
npm run build
- name: Deploy PR Preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: frontend/out
preview-branch: gh-pages
umbrella-dir: pr-preview
action: auto
cleanup:
if: github.event.action == 'closed'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Cleanup PR Preview
uses: rossjrw/pr-preview-action@v1
with:
source-dir: frontend/out
preview-branch: gh-pages
umbrella-dir: pr-preview
action: remove