C
setup github action
YU CHIH CHANGdb30b3451e5d
diff --git a/.github/workflows/deploy-pages.yml b/.github/workflows/deploy-pages.ymlnew file mode 100644index 0000000..4f739aa--- /dev/null+++ b/.github/workflows/deploy-pages.yml@@ -0,0 +1,123 @@+name: Deploy Web Installer to GitHub Pages++on:+ push:+ branches:+ - main+ paths:+ - "installer/**"+ - ".github/workflows/deploy-pages.yml"+ workflow_dispatch:++permissions:+ contents: read+ pages: write+ id-token: write++concurrency:+ group: pages+ cancel-in-progress: true++jobs:+ deploy:+ environment:+ name: github-pages+ url: ${{ steps.deployment.outputs.page_url }}+ runs-on: ubuntu-latest+ steps:+ - name: Check out repository+ uses: actions/checkout@v6++ - name: Configure GitHub Pages+ uses: actions/configure-pages@v5++ - name: Validate committed installer+ shell: bash+ run: |+ node <<'NODE'+ const { readFile, stat } = require("node:fs/promises");+ const { isAbsolute, relative, resolve, sep } = require("node:path");++ const installerRoot = resolve("installer");+ const indexPath = resolve(installerRoot, "index.html");+ const manifestPath = resolve(installerRoot, "manifest.json");++ async function requireNonEmptyFile(filePath, label) {+ let details;+ try {+ details = await stat(filePath);+ } catch (error) {+ if (error.code === "ENOENT") {+ throw new Error(`${label} is missing: ${relative(process.cwd(), filePath)}`);+ }+ throw error;+ }++ if (!details.isFile()) {+ throw new Error(`${label} is not a file: ${relative(process.cwd(), filePath)}`);+ }+ if (details.size === 0) {+ throw new Error(`${label} is empty: ${relative(process.cwd(), filePath)}`);+ }+ }++ function installerPath(manifestPartPath) {+ if (typeof manifestPartPath !== "string" || manifestPartPath.length === 0) {+ throw new Error("Every manifest part must have a non-empty string path.");+ }++ const resolvedPath = resolve(installerRoot, manifestPartPath);+ const relativePath = relative(installerRoot, resolvedPath);+ if (+ isAbsolute(relativePath) ||+ relativePath === ".." ||+ relativePath.startsWith(`..${sep}`)+ ) {+ throw new Error(`Manifest binary path resolves outside installer/: ${manifestPartPath}`);+ }+ return resolvedPath;+ }++ async function main() {+ await requireNonEmptyFile(indexPath, "Installer index");+ await requireNonEmptyFile(manifestPath, "Installer manifest");++ let manifest;+ try {+ manifest = JSON.parse(await readFile(manifestPath, "utf8"));+ } catch (error) {+ throw new Error(`Unable to parse installer/manifest.json: ${error.message}`);+ }++ const parts = Array.isArray(manifest.builds)+ ? manifest.builds.flatMap((build) =>+ Array.isArray(build?.parts) ? build.parts : [],+ )+ : [];++ if (parts.length === 0) {+ throw new Error("installer/manifest.json does not reference any binaries.");+ }++ for (const part of parts) {+ const binaryPath = installerPath(part?.path);+ await requireNonEmptyFile(binaryPath, `Manifest binary "${part.path}"`);+ }++ console.log(`Validated installer and ${parts.length} manifest-referenced binaries.`);+ }++ main().catch((error) => {+ console.error(`Installer validation failed: ${error.message}`);+ process.exit(1);+ });+ NODE++ - name: Upload installer site+ uses: actions/upload-pages-artifact@v4+ with:+ path: installer++ - name: Deploy to GitHub Pages+ id: deployment+ uses: actions/deploy-pages@v4diff --git a/README.md b/README.mdindex c9f2cf2..049048c 100644--- a/README.md+++ b/README.md@@ -1,5 +1,5 @@-# ESP32 GT7 Dashboard+# ESP32 GT7 Dashboard ([Installer](https://caa1211.github.io/esp32-gt7-dashboard/))A standalone **Gran Turismo 7 dashboard** running entirely on an ESP32.No SimHub • No PC • Auto PS5 Discoverydiff --git a/README.zh-TW.md b/README.zh-TW.mdindex c29909e..d6da508 100644--- a/README.zh-TW.md+++ b/README.zh-TW.md@@ -1,4 +1,4 @@-# ESP32 GT7 Dashboard+# ESP32 GT7 Dashboard ([線上安裝](https://caa1211.github.io/esp32-gt7-dashboard/))一個專為 **Gran Turismo 7** 打造、完全運行於 **ESP32** 的獨立儀表板。diff --git a/docs/RELEASING.md b/docs/RELEASING.mdindex 367361d..fc50a0a 100644--- a/docs/RELEASING.md+++ b/docs/RELEASING.md@@ -112,3 +112,52 @@ commit the four binaries together with any intentional manifest version change.The Pages workflow is intentionally path-filtered and uploads only `installer/`; source code,documentation, `.pio/`, and local build tooling are not included in the published artifact.++## Release and GitHub Pages deployment checklist++Use this sequence for every public firmware release:++1. Publish the firmware locally with the intended numeric version:++ ```bash+ npm run publish:firmware -- 1.2.3+ ```++ This runs `scripts/publish-firmware.mjs`; it synchronizes the version, builds with the+ local PlatformIO installation, copies the required binaries into `installer/firmware/`,+ and validates the installer files.+2. Flash and test the generated firmware on a physical ESP32-2432S028.+3. Serve the local installer without caching:++ ```bash+ http-server installer -p 8080 -c-1+ ```++4. Open <http://localhost:8080> in a Web Serial-compatible desktop browser.+5. Confirm that the Web Installer can install the locally committed firmware and that the+ flashed device works correctly.+6. Review all release changes:++ ```bash+ git diff+ git status+ ```++7. Commit the updated source, version files, manifest, and firmware binaries.+8. Push or merge the changes into `main`.+9. GitHub Actions automatically validates and deploys the committed `installer/` directory+ to GitHub Pages.+10. Verify <https://caa1211.github.io/esp32-gt7-dashboard/> and perform another installer+ test from the deployed site.+11. Create the Git tag manually only after the deployed release has been verified.++GitHub Actions does **not** install PlatformIO, build firmware, run the local publishing+script, or generate binaries. It deploys the committed files exactly as they exist under+`installer/`.++### One-time GitHub Pages setting++Configure the repository once at **Repository > Settings > Pages > Build and deployment >+Source > GitHub Actions**. The workflow uses the official Pages artifact deployment flow;+it does not create or maintain a `gh-pages` branch. The contents of `installer/` become the+site root, so the public URL has no additional `/installer/` segment.diff --git a/installer/image.png b/installer/image.pngnew file mode 100644index 0000000..4d952e2Binary files /dev/null and b/installer/image.png differdiff --git a/package.json b/package.jsonindex 42b33a5..09ff6d9 100644--- a/package.json+++ b/package.json@@ -2,6 +2,7 @@{"scripts": {- "publish": "node scripts/publish-firmware.mjs"+ "publish": "node scripts/publish-firmware.mjs",+ "publish:firmware": "node scripts/publish-firmware.mjs"}-}\ No newline at end of file+}diff --git a/photos/image.png b/photos/image.pngnew file mode 100644index 0000000..4d952e2Binary files /dev/null and b/photos/image.png differ