Files
entdb-entitlements-iOS/.github/workflows/build.yml
T
cc c16a8e9f4d Remove WASM SQLite engine and skip database download
KV backend is now the only data source - no need for SQLite.
2026-04-14 16:58:11 +02:00

93 lines
2.6 KiB
YAML

name: Build and Deploy
on:
push:
branches: [main]
repository_dispatch:
types: [data-updated]
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: Show dispatch context
if: github.event_name == 'repository_dispatch'
run: |
echo "Triggered by repository_dispatch"
echo "event_type=${{ github.event.action }}"
echo "source_repo=${{ github.event.client_payload.source_repo }}"
echo "source_sha=${{ github.event.client_payload.source_sha }}"
echo "source_ref=${{ github.event.client_payload.source_ref }}"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "npm"
- name: Setup Pages
uses: actions/configure-pages@v5
id: configure-pages
continue-on-error: true
with:
static_site_generator: next
- name: Install dependencies
run: npm ci
- name: Build with Next.js
run: npm run build
env:
NEXT_PUBLIC_BASE_PATH: ${{ steps.configure-pages.outputs.base_path || '' }}
- name: Download latest data release
env:
GH_TOKEN: ${{ github.token }}
run: |
release_json=$(curl -fsSL \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer $GH_TOKEN" \
https://api.github.com/repos/ChiChou/entdb-data/releases/latest)
data_url=$(echo "$release_json" | jq -er '.assets[] | select(.name == "data.tar.gz") | .browser_download_url')
mkdir -p out/data
curl -fL "$data_url" -o data.tar.gz
tar -xzf data.tar.gz -C out/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