diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..09aa79c --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,55 @@ +name: Build and Deploy + +on: + workflow_dispatch: + push: + branches: [main] + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + + - name: Setup pnpm + uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Setup Node + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Build + run: GITHUB_PAGES=true pnpm run build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: dist + + deploy: + needs: build + runs-on: ubuntu-latest + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/vite.config.ts b/vite.config.ts index 9379593..80980da 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -3,6 +3,7 @@ import solidPlugin from 'vite-plugin-solid'; export default defineConfig({ plugins: [solidPlugin()], + base: process.env.GITHUB_PAGES ? '/nix-evaluator-stats/' : './', server: { port: 3000, open: false,