CD #985
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: | |
| push: | |
| branches: | |
| - main | |
| schedule: | |
| # Runs "At 00:01. every day" (see https://crontab.guru) | |
| - cron: '1 0 * * *' | |
| 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 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '18.x' | |
| cache: 'yarn' | |
| cache-dependency-path: 'yarn.lock' | |
| - uses: actions/cache@v4 | |
| id: data-cache | |
| with: | |
| path: cache | |
| key: data-cache | |
| - name: Run yarn install | |
| run: yarn install | |
| - name: Generate typings | |
| run: yarn generate:type | |
| - name: Download data | |
| # NOTE: This will add env.MAPSWIPE_API_LAST_MODIFIED_EPOCH | |
| run: yarn fetch-data | |
| env: | |
| MAPSWIPE_API_ENDPOINT: ${{ vars.MAPSWIPE_API_ENDPOINT }} | |
| MAPSWIPE_REFERER_ENDPOINT: ${{ vars.MAPSWIPE_REFERER_ENDPOINT }} | |
| APP_ENVIRONMENT: ${{ vars.APP_ENVIRONMENT }} | |
| - name: Build + Test | |
| run: yarn build | |
| timeout-minutes: 30 | |
| env: | |
| # Common | |
| NODE_OPTIONS: --max_old_space_size=4096 | |
| # App ENV | |
| MAPSWIPE_API_ENDPOINT: ${{ vars.MAPSWIPE_API_ENDPOINT }} | |
| NEXT_PUBLIC_POSTHOG_KEY: ${{ vars.NEXT_PUBLIC_POSTHOG_KEY }} | |
| NEXT_PUBLIC_POSTHOG_HOST_API: ${{ vars.NEXT_PUBLIC_POSTHOG_HOST_API }} | |
| # Build Date | |
| MAPSWIPE_BUILD_DATE: ${{ env.MAPSWIPE_API_LAST_MODIFIED_EPOCH }} | |
| NEXT_PUBLIC_BASE_PREFIX: ${{ vars.NEXT_PUBLIC_BASE_PREFIX }} | |
| - name: Upload GH artifacts | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: out/ | |
| 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 |