Build and Deploy #836
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: Build and Deploy | |
| on: | |
| push: | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 0 * * *" # Runs at midnight UTC every day | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout this repo | |
| uses: actions/checkout@v4 | |
| with: | |
| path: mdn-graph | |
| - name: Checkout mdn/content repo | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: mdn/content | |
| path: content | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| - name: Set up Bun | |
| uses: oven-sh/setup-bun@v2 | |
| - name: Install dependencies for mdn/content | |
| run: | | |
| rm package-lock.json | |
| npm install | |
| working-directory: ./content | |
| - name: Install dependencies for this repo | |
| run: | | |
| bun install | |
| bun update @mdn/browser-compat-data | |
| working-directory: ./mdn-graph | |
| - name: Build mdn/content | |
| run: | | |
| npm run build -- --json-issues --json-live-samples | |
| working-directory: ./content | |
| - name: Build MDN graph | |
| run: bun build.ts graph --data-only | |
| working-directory: ./mdn-graph | |
| env: | |
| BUILT_CONTENT_ROOT: ../content/build | |
| - name: Lint | |
| run: bun build.ts lint --data-only | |
| working-directory: ./mdn-graph | |
| - name: Collect warnings | |
| run: bun build.ts warnings --data-only | |
| working-directory: ./mdn-graph | |
| - name: Build site | |
| run: bun build.ts graph warnings external-links --bundle-only | |
| working-directory: ./mdn-graph | |
| - name: Determine commit message | |
| id: commit-message | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "message=Manual update by ${{ github.actor }}" >> $GITHUB_ENV | |
| elif [ "${{ github.event_name }}" == "schedule" ]; then | |
| echo "message=Scheduled update" >> $GITHUB_ENV | |
| else | |
| echo "message=Update based on ${{ github.sha }}" >> $GITHUB_ENV | |
| fi | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./mdn-graph/docs | |
| publish_branch: gh-pages | |
| commit_message: ${{ env.message }} | |
| user_name: "github-actions[bot]" | |
| user_email: "github-actions[bot]@users.noreply.github.com" | |
| enable_jekyll: true |