CD #34
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: CD | |
| # NOTE: Don't update this | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - develop | |
| schedule: | |
| # Runs "At 00:01. every day" (see https://crontab.guru) | |
| - cron: "1 0 * * *" | |
| env: | |
| APP_GRAPHQL_CODEGEN_ENDPOINT: ${{ vars.APP_GRAPHQL_CODEGEN_ENDPOINT }} | |
| APP_GRAPHQL_ENDPOINT: ${{ vars.APP_GRAPHQL_ENDPOINT }} | |
| APP_TITLE: "Nrcs CMS" | |
| GITHUB_WORKFLOW: true | |
| jobs: | |
| test_build: | |
| name: Run Tests + Build | |
| runs-on: ubuntu-latest | |
| environment: "prod" | |
| env: | |
| PIPELINE_TYPE: cd | |
| steps: | |
| # NOTE: This uses default branch which is `main` | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Install pnpm | |
| run: npm install -g pnpm | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22.x" | |
| cache: "pnpm" | |
| cache-dependency-path: "pnpm-lock.yaml" | |
| - uses: actions/cache@v4 | |
| id: data-cache | |
| with: | |
| path: cache | |
| key: data-cache | |
| - name: Run pnpm install | |
| run: pnpm install | |
| - name: Build + Test | |
| run: pnpm run build | |
| timeout-minutes: 30 | |
| env: | |
| # Common | |
| APP_GRAPHQL_ENDPOINT: ${{ vars.APP_GRAPHQL_ENDPOINT }} | |
| APP_GRAPHQL_CODEGEN_ENDPOINT: ${{ vars.APP_GRAPHQL_CODEGEN_ENDPOINT }} | |
| BASE_PREFIX: ${{ vars.BASE_PREFIX }} | |
| NODE_OPTIONS: --max_old_space_size=4096 | |
| - name: Upload GH artifacts | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: build/ | |
| deploy: | |
| name: Deploy (GH Page) | |
| needs: test_build | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pages: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages 🚀 | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |