build: bump jupyterlab-launchpad to 1.1.1 in jupyterlab image #42
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Docs | |
| # Builds the Astro/Starlight docs site and deploys it to Cloudflare Pages. | |
| # | |
| # Requires two org- or repo-level secrets before deploy will succeed: | |
| # CLOUDFLARE_API_TOKEN | |
| # CLOUDFLARE_ACCOUNT_ID | |
| # Until those resolve for this repo, the build + link-check still run and gate | |
| # PRs; only the deploy step (and the preview comment) is skipped. Pushes to main | |
| # always attempt the deploy so a missing secret fails loudly rather than | |
| # silently shipping nothing. | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - 'docs/**' | |
| - 'scripts/check-links.sh' | |
| - '.github/workflows/docs.yml' | |
| pull_request: | |
| paths: | |
| - 'docs/**' | |
| - 'scripts/check-links.sh' | |
| - '.github/workflows/docs.yml' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| concurrency: | |
| group: docs-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| PACK_SLUG: data-science-pack | |
| jobs: | |
| docs: | |
| name: Build and deploy | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: docs/package-lock.json | |
| - name: Install dependencies | |
| working-directory: docs | |
| run: npm ci | |
| - name: Install Playwright (mermaid rendering) | |
| working-directory: docs | |
| run: npx playwright install --with-deps chromium | |
| - name: Unit tests | |
| working-directory: docs | |
| run: npm test | |
| - name: Compute site, base, and deploy branch | |
| id: base | |
| env: | |
| HEAD_REF: ${{ github.head_ref || github.ref_name }} | |
| run: | | |
| if [ "${{ github.ref }}" = "refs/heads/main" ]; then | |
| # Production: served under the portal subpath by the packs.nebari.dev Worker. | |
| echo "site=https://packs.nebari.dev" >> "$GITHUB_OUTPUT" | |
| echo "base=/${PACK_SLUG}/" >> "$GITHUB_OUTPUT" | |
| echo "branch=main" >> "$GITHUB_OUTPUT" | |
| else | |
| # Preview: its own *.pages.dev subdomain, so it lives at the root. | |
| ALIAS=$(printf '%s' "$HEAD_REF" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g') | |
| echo "site=https://${ALIAS}.${PACK_SLUG}.pages.dev" >> "$GITHUB_OUTPUT" | |
| echo "base=/" >> "$GITHUB_OUTPUT" | |
| echo "branch=${HEAD_REF}" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Build | |
| working-directory: docs | |
| env: | |
| SITE: ${{ steps.base.outputs.site }} | |
| BASE: ${{ steps.base.outputs.base }} | |
| run: npm run build | |
| - name: Check internal links | |
| env: | |
| BASE: ${{ steps.base.outputs.base }} | |
| run: SKIP_BUILD=1 bash scripts/check-links.sh | |
| # PR previews need the Cloudflare secrets; fork PRs cannot read them and | |
| # same-repo PRs may predate their provisioning, so previews skip when the | |
| # secrets are absent. Pushes to main always attempt the deploy so a | |
| # missing secret fails loudly instead of silently shipping nothing. | |
| - name: Determine deployability | |
| id: candeploy | |
| env: | |
| CF_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CF_ACCOUNT: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| run: | | |
| OK=true | |
| if [ "${{ github.event_name }}" = "pull_request" ]; then | |
| if [ -z "${CF_TOKEN}" ] || [ -z "${CF_ACCOUNT}" ]; then | |
| OK=false | |
| echo "::notice::Cloudflare secrets unavailable; skipping preview deploy (build still gates)." | |
| fi | |
| fi | |
| echo "ok=${OK}" >> "$GITHUB_OUTPUT" | |
| - name: Deploy to Cloudflare Pages | |
| id: deploy | |
| if: ${{ steps.candeploy.outputs.ok == 'true' }} | |
| uses: cloudflare/wrangler-action@ebbaa1584979971c8614a24965b4405ff95890e0 # v4.0.0 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| # `pages deploy` does not auto-create the project (API error 8000007 on | |
| # first deploy); create-if-missing keeps the workflow self-sufficient. | |
| preCommands: npx wrangler pages project create ${{ env.PACK_SLUG }} --production-branch=main || true | |
| command: pages deploy docs/dist --project-name=${{ env.PACK_SLUG }} --branch=${{ steps.base.outputs.branch }} | |
| - name: Comment preview URL | |
| if: ${{ github.event_name == 'pull_request' && steps.deploy.outcome == 'success' }} | |
| uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # v3.0.5 | |
| with: | |
| header: docs-preview | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| message: | | |
| **Docs preview** for `${{ github.event.pull_request.head.ref }}`: | |
| ${{ steps.deploy.outputs.pages-deployment-alias-url }} |