Skip to content

Commit 1625b7a

Browse files
authored
feat(ci): added netlify toml to correctly build astro (#176)
## Summary This pull request introduces comprehensive documentation and configuration updates to clarify and standardize deployment processes for the Interledger Developers Portal. The main focus is on improving developer onboarding, ensuring deployment consistency between preview and production environments, and deprecating outdated workflows. Below are the most important changes grouped by theme: **Documentation & Developer Guidance** * Added a new `.github/copilot-instructions.md` file detailing project architecture, deployment procedures, configuration notes, common pitfalls, and development philosophy to help contributors and AI agents understand the project. * Updated `README.md` to include clear explanations of both Netlify preview deployments and Google Cloud production deployments, as well as guidance on legacy workflow deprecation. **Deployment Configuration** * Added a new `netlify.toml` configuration file that standardizes the build process using Bun, ensures the build output is nested under `_netlify/builders/developers`, and sets up redirect rules for proper client-side routing under the `/developers` base path. **Workflow Deprecation** * Marked `.github/workflows/deploy.yml` as deprecated, directing contributors to use the new Google Cloud deployment workflow instead.
1 parent 8972bfa commit 1625b7a

File tree

5 files changed

+249
-72
lines changed

5 files changed

+249
-72
lines changed

.github/copilot-instructions.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# GitHub Copilot Instructions for Interledger Developers Portal
2+
3+
## Project Overview
4+
5+
This is the Interledger Developers Portal, a documentation site built with [Astro](https://astro.build/) and [Starlight](https://starlight.astro.build/). It serves as the `/developers` section of [interledger.org](https://interledger.org/).
6+
7+
**⚠️ Important**: When a deployment configuration, build process, or new gotcha is discovered, please update this file to keep it accurate. This helps AI agents and future contributors understand the project correctly.
8+
9+
## Architecture
10+
11+
- **Framework**: Astro with Starlight documentation framework
12+
- **Package Manager**: Bun (not npm/yarn)
13+
- **Build Output**: `dist/` directory
14+
- **Base Path**: `/developers` (configured in `astro.config.mjs`)
15+
16+
## Deployment
17+
18+
### Preview (Netlify)
19+
- Every PR generates an automatic preview at `https://deploy-preview-{PR}--developers-preview.netlify.app/developers/`
20+
- Configured via `netlify.toml`
21+
- Build command: `npm install -g bun && bun install && bun run build`
22+
- **Important**: Build output is copied to `_netlify/builders/developers/` to serve at `/developers/` path
23+
- Redirect rules route `/developers/*` to `/developers/index.html` for client-side routing
24+
25+
### Production (Google Cloud)
26+
- Deployed to `https://interledger.org/developers/` via Google Cloud Storage
27+
- Triggered automatically on merge to `main` by `.github/workflows/deploy_gcs.yml`
28+
- Process: Build → Deploy to GCS → Rebuild nginx-rewrite Cloud Run service → Invalidate CDN
29+
- **Legacy**: `deploy.yml` exists but is deprecated - use `deploy_gcs.yml`
30+
31+
## Key Development Notes
32+
33+
### Configuration
34+
- **`astro.config.mjs`**: Defines site structure, integrations, and plugins. Base path is hardcoded to `/developers`
35+
- **`netlify.toml`**: Handles Netlify-specific build and deployment configuration with path rewrites
36+
- Keep both Astro config and Netlify config in sync when changing base paths or build output
37+
38+
### Static Assets
39+
- Public files go in `public/` directory
40+
- Images should reference paths like `/developers/img/filename.png` (includes the base path)
41+
- Scripts in `public/scripts/` are referenced with full `/developers/scripts/` path
42+
43+
### Content
44+
- Blog posts: `src/content/blog/`
45+
- Documentation: `src/content/docs/`
46+
- Components: `src/components/`
47+
- Layouts: `src/layouts/`
48+
- Starlight documentation framework handles sidebar, search, and routing automatically
49+
50+
### Common Commands
51+
- `bun run start` - Local dev server at `localhost:1103`
52+
- `bun run build` - Build to `dist/`
53+
- `bun run format` - Fix code formatting and linting
54+
- `bun run lint` - Check code formatting and linting
55+
56+
## Development Philosophy
57+
58+
- Keep the `/developers` base path consistent across all configurations
59+
- Netlify preview should match production behavior exactly - both serve at `/developers/`
60+
- Always test builds locally before pushing: `bun run build && bun run preview`
61+
- Use Bun for all package management - don't mix with npm/yarn
62+
- Link validation is enabled locally but disabled on Netlify (see `astro.config.mjs`)
63+
64+
## Common Pitfalls
65+
66+
1. **Asset paths**: Don't forget the `/developers` prefix in asset URLs
67+
2. **Base path changes**: If modifying base path, update both `astro.config.mjs` AND the Netlify build output path logic
68+
3. **Package manager**: Use `bun install`, not `npm install`
69+
4. **Netlify preview**: Output must be nested under `/developers` in publish directory - this is why we copy to `_netlify/builders/developers/`

.github/workflows/deploy.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# NOTE THAT THIS SCRIPT WILL BE DEPRECATED SOON. PLEASE USE THE NEW WORKFLOW IN `.github/workflows/deploy_gcs.yml` INSTEAD.
12
name: Deploy to AWS
23

34
on:

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,30 @@ ESLint is configured to work with TypeScript and Astro files. The configuration
6969

7070
### 👀 Want to learn more?
7171

72-
Check out [Starlight’s docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
72+
Check out [Starlight's docs](https://starlight.astro.build/), read [the Astro documentation](https://docs.astro.build), or jump into the [Astro Discord server](https://astro.build/chat).
73+
74+
## Deployment Notes
75+
76+
This project has two deployment mechanisms:
77+
78+
### Preview Deployments (Netlify)
79+
80+
Every pull request automatically generates a preview deployment on Netlify at `https://deploy-preview-{PR_NUMBER}--developers-preview.netlify.app/developers/`. This allows reviewers to see changes before they're merged. The Netlify configuration is defined in `netlify.toml`.
81+
82+
### Production Deployments (Google Cloud Storage)
83+
84+
The real production deployment is served through Google Cloud Storage (GCS) at `https://interledger.org/developers/` as part of the main Interledger website. This is a transparent proxy configuration - the developers portal is hosted separately but appears as part of the main domain.
85+
86+
When a PR is merged to the `main` branch, the `.github/workflows/deploy_gcs.yml` GitHub Actions workflow automatically:
87+
88+
1. Builds the site using Bun
89+
2. Deploys the built files to Google Cloud Storage (`gs://interledger-websites-public/developers`)
90+
3. Rebuilds and deploys the nginx-rewrite Cloud Run service (which handles the `/developers` proxy routing)
91+
4. Invalidates the CDN cache to ensure new content is served immediately
92+
93+
**Note:** There is a legacy `deploy.yaml` workflow in `.github/workflows/` which is being deprecated. New deployments should use `deploy_gcs.yml`.
94+
95+
For more information about the main Interledger.org infrastructure and deployment pipeline, see the [`interledger.org-v4`](https://github.com/interledger/interledger.org-v4) repository.
7396

7497
Thank You for Contributing! We appreciate your effort to write a blog post and share your expertise with the community!
7598

0 commit comments

Comments
 (0)