README.md (2127B)
1 # 14 — Build Docusaurus & Publish to S3 2 3 This example shows how to build a documentation site and deploy the static 4 output to an AWS S3 bucket using Jaypore CI. 5 6 ## How it works 7 8 1. **Build** — The CI script checks for a real Docusaurus project 9 (`package.json` containing `docusaurus`). If found it runs `npm run build`; 10 otherwise it falls back to a lightweight `build.sh` that converts Markdown 11 to HTML with pandoc (or plain sed when pandoc is unavailable). 12 13 2. **Artifact collection** — The generated HTML is copied to 14 `$JCI_OUTPUT_DIR/build/` so it is available as a CI artifact. 15 16 3. **S3 deploy** — If AWS credentials and an S3 bucket are configured the 17 output is synced to S3 with `aws s3 sync`. If the variables are missing 18 the deploy step is skipped gracefully. 19 20 ## Using a real Docusaurus project 21 22 For a production setup, replace the simple `docs/` + `build.sh` scaffold with 23 a full Docusaurus project: 24 25 ```bash 26 npx create-docusaurus@latest my-docs classic 27 ``` 28 29 Then place the generated project files in this directory. The CI script will 30 automatically detect `package.json` and run `npm run build` instead of the 31 fallback. 32 33 ## Configuring S3 credentials 34 35 Set these environment variables (e.g. in your Jaypore CI secrets): 36 37 | Variable | Required | Description | 38 |-------------------------|----------|--------------------------------------| 39 | `AWS_ACCESS_KEY_ID` | Yes | AWS access key | 40 | `AWS_SECRET_ACCESS_KEY` | Yes | AWS secret key | 41 | `S3_BUCKET` | Yes | Target bucket, e.g. `s3://my-docs` | 42 | `AWS_REGION` | No | AWS region (default `us-east-1`) | 43 44 Without these variables the pipeline still succeeds — it simply skips the 45 deploy step and prints a message. 46 47 ## Files 48 49 ``` 50 14-docusaurus-s3/ 51 ├── .jci/ 52 │ └── run.sh # Jaypore CI entry point 53 ├── docs/ 54 │ └── index.md # Sample documentation page 55 ├── build.sh # Lightweight Markdown → HTML builder 56 └── README.md # This file 57 ```