CD #483
This file contains 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 | |
steps: | |
# NOTE: This uses default branch which is `main` | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '18.x' | |
cache: 'yarn' | |
cache-dependency-path: 'yarn.lock' | |
- uses: actions/cache@v3 | |
id: data-cache | |
with: | |
path: cache | |
key: data-cache | |
- name: Run yarn install | |
run: yarn install | |
- name: Download data | |
# NOTE: This will add env.MAPSWIPE_API_LAST_MODIFIED_EPOCH | |
run: ./scripts/download-data.sh | |
env: | |
MAPSWIPE_API_ENDPOINT: ${{ vars.MAPSWIPE_API_ENDPOINT }} | |
- name: Build + Test | |
run: yarn build | |
timeout-minutes: 30 | |
env: | |
# Common | |
NODE_OPTIONS: --max_old_space_size=4096 | |
# App ENV | |
MAPSWIPE_COMMUNITY_API_ENDPOINT: ${{ vars.MAPSWIPE_COMMUNITY_API_ENDPOINT }} | |
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 }} | |
- name: Upload GH artifacts | |
uses: actions/upload-pages-artifact@v1 | |
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@v2 |