Skip to content

Commit

Permalink
feat: publish sandbox to github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdehaven committed Jan 8, 2024
1 parent 89dd163 commit 687f91f
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 1 deletion.
59 changes: 59 additions & 0 deletions .github/workflows/github-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Deploy Sandbox to GitHub Pages

on:
push:
branches:
# TODO: Change to `main` once `alpha` branch is merged
- alpha

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: 'pages'
cancel-in-progress: false

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM with Dependencies
uses: ./.github/actions/setup-pnpm-with-dependencies/
with:
force-install: true

- name: Build Sandbox
env:
# Tell the script to use the sandbox directory
USE_SANDBOX: true
run: pnpm run build:sandbox

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload sandbox/dist directory
path: './sandbox/dist'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default defineConfig({
},
},
// TODO: If deploying to GitHub pages, enable this line
// base: process.env.USE_SANDBOX ? '/markdown/' : '/',
base: process.env.USE_SANDBOX ? '/markdown/' : '/',
build: {
lib: process.env.USE_SANDBOX
? undefined
Expand Down

0 comments on commit 687f91f

Please sign in to comment.