blueloveTH 2 дней назад
Родитель
Сommit
35b989e95e

+ 41 - 0
.github/WEBSITE.md

@@ -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).

+ 17 - 5
.github/workflows/website.yml

@@ -5,9 +5,14 @@ on:
     branches: [ main ]
     branches: [ main ]
   pull_request:
   pull_request:
     branches: [ main ]
     branches: [ main ]
+  workflow_dispatch:
 
 
 permissions:
 permissions:
-  contents: write
+  contents: read
+
+concurrency:
+  group: website-${{ github.ref }}
+  cancel-in-progress: true
 
 
 jobs:
 jobs:
   deploy:
   deploy:
@@ -31,12 +36,19 @@ jobs:
     - name: Compile
     - name: Compile
       run: |
       run: |
         bash build_web.sh
         bash build_web.sh
+        mkdir -p docs/.retype/static
         mv web docs/.retype/static
         mv web docs/.retype/static
+        touch docs/.retype/.nojekyll
     ###################################################
     ###################################################
-    - uses: crazy-max/ghaction-github-pages@v3
+    - name: Deploy to pocketpy.github.io
+      uses: crazy-max/ghaction-github-pages@v3
       with:
       with:
-        target_branch: gh-pages
+        repo: pocketpy/pocketpy.github.io
+        target_branch: main
+        keep_history: true
         build_dir: docs/.retype
         build_dir: docs/.retype
+        jekyll: false
       env:
       env:
-        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
-      if: github.ref == 'refs/heads/main'
+        # PAT with Contents: write permission on pocketpy/pocketpy.github.io.
+        GH_PAT: ${{ secrets.WEBSITE_DEPLOY_TOKEN }}
+      if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.repository == 'pocketpy/pocketpy'

+ 2 - 2
CITATION.cff

@@ -9,9 +9,9 @@ message: >-
 type: software
 type: software
 authors:
 authors:
   - name: blueloveTH
   - name: blueloveTH
-    website: 'https://pocketpy.dev'
+    website: 'https://pocketpy.github.io'
 repository-code: 'https://github.com/pocketpy/pocketpy'
 repository-code: 'https://github.com/pocketpy/pocketpy'
-url: 'https://pocketpy.dev'
+url: 'https://pocketpy.github.io'
 abstract: >-
 abstract: >-
   A portable python 3.x interpreter in modern C for game scripting.
   A portable python 3.x interpreter in modern C for game scripting.
 keywords:
 keywords:

+ 3 - 3
README.md

@@ -30,8 +30,8 @@ It aims to be an alternative to Lua for game scripting, with elegant syntax, pow
 pocketpy has no dependencies other than the C standard library, which can be easily integrated into your C/C++ project.
 pocketpy has no dependencies other than the C standard library, which can be easily integrated into your C/C++ project.
 Developers are able to write Python bindings via C-API or pybind11 compatible interfaces.
 Developers are able to write Python bindings via C-API or pybind11 compatible interfaces.
 
 
-Please see https://pocketpy.dev for details and try the following resources.
-+ [Live Python Demo](https://pocketpy.dev/static/web/): Run Python code in your browser
+Please see https://pocketpy.github.io for details and try the following resources.
++ [Live Python Demo](https://pocketpy.github.io/static/web/): Run Python code in your browser
 + [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
 + [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
 + [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
 + [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
 + [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
 + [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
@@ -180,7 +180,7 @@ __ERROR:
 Currently, pkpy is as fast as cpython 3.9.
 Currently, pkpy is as fast as cpython 3.9.
 Performance results for cpython 3.9 are applicable to for pkpy.
 Performance results for cpython 3.9 are applicable to for pkpy.
 
 
-See https://pocketpy.dev/performance/ for details.
+See https://pocketpy.github.io/performance/ for details.
 
 
 And these are the results of the primes benchmark on Intel i5-12400F, WSL (Ubuntu 20.04 LTS), which *roughly* reflects the performance among c++, lua, pkpy and cpython.
 And these are the results of the primes benchmark on Intel i5-12400F, WSL (Ubuntu 20.04 LTS), which *roughly* reflects the performance among c++, lua, pkpy and cpython.
 
 

+ 1 - 1
docs/features/differences.md

@@ -16,7 +16,7 @@ game scripting, not cpython for general purpose programming.**
 
 
 pkpy supports most of the syntax and semantics of python.
 pkpy supports most of the syntax and semantics of python.
 For performance and simplicity, some features are not implemented, or behave differently.
 For performance and simplicity, some features are not implemented, or behave differently.
-The easiest way to test a feature is to [try it on your browser](https://pocketpy.dev/static/web/).
+The easiest way to test a feature is to [try it on your browser](https://pocketpy.github.io/static/web/).
 
 
 ## Unimplemented features
 ## Unimplemented features
 
 

+ 1 - 1
docs/features/threading.md

@@ -141,7 +141,7 @@ World Generation Complete 3 10000 10
 
 
 `ComputeThread` uses `pickle` module to serialize the data between threads.
 `ComputeThread` uses `pickle` module to serialize the data between threads.
 Parameters and return values must be supported by `pickle`.
 Parameters and return values must be supported by `pickle`.
-See [pickle](https://pocketpy.dev/modules/pickle/) for more details.
+See [pickle](https://pocketpy.github.io/modules/pickle/) for more details.
 
 
 Since `ComputeThread` is backed by a separate `VM` instance,
 Since `ComputeThread` is backed by a separate `VM` instance,
 it does not share any state with the main thread
 it does not share any state with the main thread

+ 1 - 1
docs/index.md

@@ -10,7 +10,7 @@ It aims to be an alternative to Lua for game scripting, with elegant syntax, pow
 pocketpy has no dependencies other than the C standard library, which can be easily integrated into your C/C++ project.
 pocketpy has no dependencies other than the C standard library, which can be easily integrated into your C/C++ project.
 Developers are able to write Python bindings via C-API or pybind11 compatible interfaces.
 Developers are able to write Python bindings via C-API or pybind11 compatible interfaces.
 
 
-+ [Live Python Demo](https://pocketpy.dev/static/web/): Run Python code in your browser
++ [Live Python Demo](https://pocketpy.github.io/static/web/): Run Python code in your browser
 + [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
 + [Live C Examples](https://pocketpy.github.io/examples/): Explore C-APIs in your browser
 + [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
 + [Godot Extension](https://github.com/pocketpy/godot-pocketpy): Use pocketpy in Godot Engine
 + [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode
 + [VSCode Extension](https://marketplace.visualstudio.com/items?itemName=pocketpy.pocketpy): Debug and profile pocketpy scripts in VSCode

+ 2 - 2
docs/retype.yml

@@ -1,6 +1,6 @@
 input: .
 input: .
 output: .retype
 output: .retype
-url: https://pocketpy.dev
+url: https://pocketpy.github.io
 branding:
 branding:
   title: pocketpy
   title: pocketpy
   label: v2.2.0
   label: v2.2.0
@@ -14,7 +14,7 @@ links:
     link: ""
     link: ""
   - text: "Live Demo"
   - text: "Live Demo"
     icon: play
     icon: play
-    link: "https://pocketpy.dev/static/web/"
+    link: "https://pocketpy.github.io/static/web/"
     target: blank
     target: blank
   - text: "Live Examples"
   - text: "Live Examples"
     icon: code
     icon: code

+ 1 - 1
plugins/flutter/pocketpy/ios/pocketpy.podspec

@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
   s.description      = <<-DESC
   s.description      = <<-DESC
 A new Flutter FFI plugin project.
 A new Flutter FFI plugin project.
                        DESC
                        DESC
-  s.homepage         = 'https://pocketpy.dev'
+  s.homepage         = 'https://pocketpy.github.io'
   s.license          = { :file => '../LICENSE' }
   s.license          = { :file => '../LICENSE' }
   s.author           = { 'blueloveTH' => 'blueloveth@foxmail.com' }
   s.author           = { 'blueloveTH' => 'blueloveth@foxmail.com' }
 
 

+ 1 - 1
plugins/flutter/pocketpy/macos/pocketpy.podspec

@@ -9,7 +9,7 @@ Pod::Spec.new do |s|
   s.description      = <<-DESC
   s.description      = <<-DESC
 A new Flutter FFI plugin project.
 A new Flutter FFI plugin project.
                        DESC
                        DESC
-  s.homepage         = 'https://pocketpy.dev'
+  s.homepage         = 'https://pocketpy.github.io'
   s.license          = { :file => '../LICENSE' }
   s.license          = { :file => '../LICENSE' }
   s.author           = { 'blueloveTH' => 'blueloveth@foxmail.com' }
   s.author           = { 'blueloveTH' => 'blueloveth@foxmail.com' }
 
 

+ 1 - 1
plugins/flutter/pocketpy/pubspec.yaml

@@ -1,7 +1,7 @@
 name: pocketpy
 name: pocketpy
 description: A lightweight Python interpreter for game engines. It supports Android/iOS/Windows/Linux/MacOS.
 description: A lightweight Python interpreter for game engines. It supports Android/iOS/Windows/Linux/MacOS.
 version: 2.2.0
 version: 2.2.0
-homepage: https://pocketpy.dev
+homepage: https://pocketpy.github.io
 repository: https://github.com/pocketpy/pocketpy
 repository: https://github.com/pocketpy/pocketpy
 
 
 environment:
 environment: