|
|
@@ -0,0 +1,41 @@
|
|
|
+# Website deployment
|
|
|
+
|
|
|
+`workflows/website.yml` builds the documentation at `/` and the Python demo at
|
|
|
+`/static/web/`, then publishes them to the `main` branch of
|
|
|
+`pocketpy/pocketpy.github.io`. Pull requests only build; pushes to `main` and
|
|
|
+manual runs on `main` can publish. The published root contains an empty
|
|
|
+`.nojekyll` file to disable Jekyll.
|
|
|
+
|
|
|
+Before the first deployment:
|
|
|
+
|
|
|
+1. Add the `WEBSITE_DEPLOY_TOKEN` Actions secret to `pocketpy/pocketpy`. Use a
|
|
|
+ personal access token with **Contents: Read and write** access to
|
|
|
+ `pocketpy/pocketpy.github.io` (and organization approval if required).
|
|
|
+2. In `pocketpy/pocketpy.github.io`, configure Pages to **Deploy from a branch**,
|
|
|
+ using `main` and `/ (root)`. Leave the custom domain empty.
|
|
|
+3. Run the website workflow and verify the documentation and demo at
|
|
|
+ `https://pocketpy.github.io/` and `https://pocketpy.github.io/static/web/`.
|
|
|
+
|
|
|
+## Redirect the old domain
|
|
|
+
|
|
|
+After verifying the new site, configure a Cloudflare **Single Redirect** for
|
|
|
+`pocketpy.dev`. Enable Cloudflare proxying (orange cloud) for the old domain's
|
|
|
+DNS records; DNS-only records cannot apply redirect rules.
|
|
|
+
|
|
|
+- Custom filter expression: `http.host in {"pocketpy.dev" "www.pocketpy.dev"}`
|
|
|
+- URL redirect type: **Dynamic**
|
|
|
+- Target expression: `concat("https://pocketpy.github.io", http.request.uri.path)`
|
|
|
+- Status code: **301**
|
|
|
+- **Preserve query string**: enabled
|
|
|
+
|
|
|
+Only include `www.pocketpy.dev` if that hostname is configured. For example,
|
|
|
+`https://pocketpy.dev/static/web/?example=hello` should return a 301 redirect to
|
|
|
+`https://pocketpy.github.io/static/web/?example=hello`.
|
|
|
+
|
|
|
+This redirect is configured in Cloudflare, not generated by the workflow.
|
|
|
+Keep the old domain and redirect active during the migration, and submit the
|
|
|
+new sitemap and address change in Google Search Console.
|
|
|
+
|
|
|
+References: [deployment action](https://github.com/crazy-max/ghaction-github-pages/tree/v3#environment-variables),
|
|
|
+[Cloudflare redirect setup](https://developers.cloudflare.com/rules/url-forwarding/single-redirects/create-dashboard/),
|
|
|
+[Google's permanent redirects](https://developers.google.com/search/docs/crawling-indexing/301-redirects).
|