From b5e80b44ef377cdc5c8eec5d823612521fdea462 Mon Sep 17 00:00:00 2001 From: Claas Date: Tue, 28 May 2024 00:39:51 +0200 Subject: [PATCH] Configure GitHub pages deployment for demo --- .github/workflows/deploy.yml | 69 ++++++++++++++++++++++++++++++++++++ app.config.ts | 6 +++- 2 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..98370fe --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,69 @@ +name: Deploy Page + +on: + # Workflow dispatch only works when version has not been published yet + workflow_dispatch: + push: + branches: ["main"] + tags: + # Publish npm package when a new tag is pushed + - "*.*.*" + +# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages +permissions: + contents: read + pages: write + id-token: write + +# Allow one concurrent deployment +concurrency: + group: "pages" + cancel-in-progress: true + +jobs: + build: + defaults: + run: + working-directory: solid-start + runs-on: ubuntu-latest + steps: + - name: 🛎️ Checkout + uses: actions/checkout@v4 + - uses: pnpm/action-setup@v3 + with: + version: 9 + - name: 🦭 Setup Node + uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: pnpm + - name: 🛬 Install dependencies + run: pnpm install + - name: 👷 Build + run: pnpm build + # No tests + #- name: Test + # run: pnpm test + # Copy index.html to 404.html to serve the same file when a file is not found. This fixes GitHub Pages routing issues + - name: 🚷 Show index instead of 404 + run: cp .output/public/index.html .output/public/404.html + - name: 🆙 Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: solid-start/.output/public + + deploy: + # Only start after build + needs: build + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: 🛎️ Checkout + uses: actions/checkout@v4 + - name: 🚨 Setup Pages + uses: actions/configure-pages@v5 + - name: 🚀 Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/app.config.ts b/app.config.ts index de7f831..c7d2ec3 100644 --- a/app.config.ts +++ b/app.config.ts @@ -1,3 +1,7 @@ import { defineConfig } from "@solidjs/start/config"; -export default defineConfig({}); +export default defineConfig({ + server: { + preset: "github-pages", + }, +}); -- knotmirror 0.0.1