Deploy DBML Homepage with Playground to GitHub Pages #53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy DBML Homepage with Playground to GitHub Pages | |
| on: workflow_dispatch | |
| jobs: | |
| build: | |
| name: Build Homepage and Playground | |
| runs-on: blacksmith-2vcpu-ubuntu-2204 | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node environment | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20.x | |
| - name: Cache root node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| .yarn/cache | |
| key: ${{ runner.os }}-yarn-root-${{ hashFiles('yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn-root- | |
| - name: Install dependencies (root) | |
| run: yarn install --frozen-lockfile | |
| - name: Build the @dbml/parse package | |
| run: yarn workspace @dbml/parse build | |
| - name: Build the @dbml/core package | |
| run: NODE_OPTIONS="--max-old-space-size=8192" yarn workspace @dbml/core build | |
| - name: Build playground | |
| run: NODE_OPTIONS="--max-old-space-size=8192" yarn workspace @dbml/playground build | |
| - name: Clean up old playground build | |
| run: rm -rf dbml-homepage/static/playground | |
| - name: Copy playground dist to homepage static | |
| run: cp -r dbml-playground/dist dbml-homepage/static/playground | |
| - name: Cache homepage node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| dbml-homepage/node_modules | |
| dbml-homepage/.yarn/cache | |
| key: ${{ runner.os }}-yarn-homepage-${{ hashFiles('dbml-homepage/yarn.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-yarn-homepage- | |
| - name: Install homepage dependencies | |
| working-directory: dbml-homepage | |
| run: yarn install --frozen-lockfile | |
| - name: Build homepage | |
| working-directory: dbml-homepage | |
| run: yarn build | |
| - name: Upload build artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: dbml-homepage/build | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: build | |
| # Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
| permissions: | |
| pages: write # to deploy to Pages | |
| id-token: write # to verify the deployment originates from an appropriate source | |
| # Deploy to the github-pages environment | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: blacksmith-2vcpu-ubuntu-2204 | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |