Update all non-major dependencies #724
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
| # .github/workflows/deploy.yml | |
| # | |
| # This workflow will do a clean installation of node dependencies, | |
| # cache/restore them, build the source code, run tests across different versions | |
| # of node, and deploy to GitHub Pages. For more information see: | |
| # https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
| # | |
| # DEPENDENCY UPDATE BEHAVIOR: | |
| # - Dependabot and Renovate PRs use 'deps/' branch prefix and 'deps:' commit prefix | |
| # - Deploy is skipped for dependency updates to avoid unnecessary deployments | |
| # - Use the batch merge process below to efficiently handle multiple dependency PRs | |
| # | |
| # BATCH DEPENDENCY UPDATE PROCESS: | |
| # 1. Create batch branch and merge all dependency PRs into it: | |
| # git checkout -b batch/deps-$(date +%Y%m%d) | |
| # gh pr list --author app/dependabot --json number,headRefName | jq -r '.[] | .headRefName' | while read branch; do | |
| # git fetch origin "$branch:$branch" && git merge "$branch" --no-edit | |
| # done | |
| # gh pr list --author app/renovate --json number,headRefName | jq -r '.[] | .headRefName' | while read branch; do | |
| # git fetch origin "$branch:$branch" && git merge "$branch" --no-edit | |
| # done | |
| # 2. Push batch branch and create PR for review: | |
| # git push origin batch/deps-$(date +%Y%m%d) | |
| # gh pr create --title "Batch dependency updates $(date +%Y-%m-%d)" --body "Combined dependency updates" | |
| # 3. After review, merge the batch PR (triggers single deployment) | |
| # 4. Close individual dependency PRs: | |
| # gh pr list --author app/dependabot --json number | jq -r '.[].number' | xargs -I {} gh pr close {} | |
| # gh pr list --author app/renovate --json number | jq -r '.[].number' | xargs -I {} gh pr close {} | |
| --- | |
| name: Node.js CI and Deploy | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # Allows the workflow to be manually triggered from the Grand UI of Actions | |
| workflow_dispatch: | |
| inputs: | |
| debug_enabled: | |
| type: boolean | |
| description: "Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)" | |
| required: false | |
| default: false | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: deploy-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: pnpm/action-setup@v2 | |
| with: | |
| version: 10.31.0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 20.x | |
| cache: pnpm | |
| - run: pnpm install | |
| # Set base URL for GitHub Pages | |
| - name: Set base URL for custom domain | |
| run: | | |
| if [ -f "./public/CNAME" ] || [ -f "./static/CNAME" ]; then | |
| echo "VITE_BASE_URL=/" >> .env.production | |
| else | |
| echo "VITE_BASE_URL=/starlight/" >> .env.production | |
| fi | |
| - name: Build | |
| run: pnpm run build | |
| # Configure Pages | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v5 | |
| # Upload Pages artifact for GitHub Pages deployment | |
| - name: Upload Pages artifact | |
| uses: actions/upload-pages-artifact@v4 | |
| with: | |
| path: ./dist | |
| include-hidden-files: true | |
| # Upload build artifact for workflow records (optional) | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| name: dist-files | |
| path: ./dist | |
| retention-days: 7 | |
| # Deploy job | |
| deploy: | |
| # Add a dependency to the build job | |
| needs: build | |
| # Deploy to the github-pages environment | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| # Only deploy on push to main branch, skip dependency update commits | |
| # This condition skips deployment when commits contain 'deps:' prefix (from dependabot/renovate) | |
| # allowing dependency updates to merge without triggering unnecessary deployments | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'deps:') | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |