From 052b739cb225e145688d152d2fa80c234488b16e Mon Sep 17 00:00:00 2001 From: PaarthPandey10 Date: Thu, 5 Nov 2026 10:30:46 +0400 Subject: [PATCH] feat(astro): deploy live demo to GitHub Pages with iframe bridge Signed-off-by: PaarthPandey10 --- .github/workflows/pages.yml | 81 ++++++++++++++++++++++++ examples/astro/astro.config.mjs | 2 + examples/astro/package.json | 2 +- examples/astro/src/pages/index.astro | 95 ++++++++++++++++++++++++++++ 4 files changed, 179 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pages.yml diff --git a/.github/workflows/pages.yml b/.github/workflows/pages.yml new file mode 100644 index 0000000..64e997d --- /dev/null +++ b/.github/workflows/pages.yml @@ -0,0 +1,81 @@ +name: Deploy Astro Demo + +on: + push: + branches: [main] + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout gemara-react + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + path: gemara-react + persist-credentials: false + + - name: Read pinned spec version + id: spec + working-directory: gemara-react + run: echo "ref=$(cat .spec-version)" >> "$GITHUB_OUTPUT" + + - name: Checkout gemara fixtures + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + repository: gemaraproj/gemara + ref: ${{ steps.spec.outputs.ref }} + path: gemara + persist-credentials: false + + - name: Setup Node + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + cache: npm + cache-dependency-path: gemara-react/package-lock.json + + - name: Install package dependencies + working-directory: gemara-react + run: npm ci + + - name: Build package + working-directory: gemara-react + run: npm run build + + - name: Install Astro example dependencies + working-directory: gemara-react/examples/astro + run: npm ci + + - name: Build Astro example + working-directory: gemara-react/examples/astro + run: npm run build + + - name: Setup Pages + uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0 + + - name: Upload Pages artifact + uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0 + with: + path: gemara-react/examples/astro/dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + permissions: + pages: write + id-token: write + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0 diff --git a/examples/astro/astro.config.mjs b/examples/astro/astro.config.mjs index aa80871..6cdc0c9 100644 --- a/examples/astro/astro.config.mjs +++ b/examples/astro/astro.config.mjs @@ -4,4 +4,6 @@ import react from "@astrojs/react"; export default defineConfig({ integrations: [react()], output: "static", + site: "https://gemaraproj.github.io", + base: "/gemara-react/", }); diff --git a/examples/astro/package.json b/examples/astro/package.json index c4ea753..590f8b3 100644 --- a/examples/astro/package.json +++ b/examples/astro/package.json @@ -7,7 +7,7 @@ "dev": "astro dev", "build": "astro build", "preview": "astro preview", - "a11y": "pa11y-ci --config .pa11yci.json file://$PWD/dist/index.html" + "a11y": "pa11y-ci --config .pa11yci.json dist/index.html" }, "dependencies": { "@astrojs/react": "^7.1.1", diff --git a/examples/astro/src/pages/index.astro b/examples/astro/src/pages/index.astro index e8e48aa..78fbd01 100644 --- a/examples/astro/src/pages/index.astro +++ b/examples/astro/src/pages/index.astro @@ -73,7 +73,74 @@ const others = [ + gemara-react Astro example +
@@ -155,5 +222,33 @@ const others = [ ))}
+