Test and Release #627
Workflow file for this run
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: Test and Release | |
| # Run this job on all pushes to main, for pull requests, and merge queue | |
| on: | |
| push: | |
| branches: | |
| # This avoids having duplicate builds in non-forked PRs | |
| - "main" | |
| pull_request: {} | |
| merge_group: {} | |
| # Cancel previous PR/branch runs when a new commit is pushed | |
| concurrency: | |
| group: ${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # =================== | |
| # Tests everything | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22] # This should be LTS | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Check TypeScript code | |
| run: yarn check | |
| - name: Run linter | |
| run: yarn run lint | |
| - name: Validate config files | |
| run: yarn check:configs | |
| - name: Run component tests | |
| run: yarn run test:ci | |
| - name: Check file download/integrity of changed files | |
| if: github.event_name == 'pull_request' | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| script: | | |
| const script = require(`${process.env.GITHUB_WORKSPACE}/.github/scripts/check-integrity.cjs`); | |
| return script({github, context, core}); | |
| # =================== | |
| # Deploys successful builds on the main branch to Cloudflare | |
| deploy: | |
| if: | | |
| github.event_name == 'push' && | |
| github.ref == 'refs/heads/main' | |
| needs: [test] | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [22] # This should be LTS | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'yarn' | |
| - name: Install dependencies | |
| run: yarn install --immutable | |
| - name: Publish to Cloudflare | |
| uses: cloudflare/wrangler-action@v3 | |
| with: | |
| apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| packageManager: yarn | |
| - name: Upload config files to Cloudflare | |
| env: | |
| BASE_URL: ${{ secrets.BASE_URL }} | |
| ADMIN_SECRET: ${{ secrets.ADMIN_SECRET }} | |
| run: yarn upload |