data-update/production #197
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
| # Build and deploy the project when data is updated | |
| name: "Build and Deploy on Data Update" | |
| on: | |
| repository_dispatch: | |
| types: | |
| - data-update/develop | |
| - data-update/staging | |
| - data-update/production | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Free up disk space | |
| uses: easimon/maximize-build-space@master | |
| with: | |
| root-reserve-mb: 4096 | |
| swap-size-mb: 1024 | |
| remove-dotnet: 'true' | |
| remove-android: 'true' | |
| remove-haskell: 'true' | |
| remove-codeql: 'true' | |
| remove-docker-images: 'true' | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set environment develop | |
| if: github.event.action == 'data-update/develop' | |
| run: | | |
| echo "COKI_ENVIRONMENT=develop" >> $GITHUB_ENV | |
| echo "REPO_DISPATCH_REF=develop" >> $GITHUB_ENV | |
| - name: Set environment staging | |
| if: github.event.action == 'data-update/staging' | |
| run: | | |
| echo "COKI_ENVIRONMENT=staging" >> $GITHUB_ENV | |
| echo "REPO_DISPATCH_REF=main" >> $GITHUB_ENV | |
| - name: Get latest tag production | |
| if: github.event.action == 'data-update/production' | |
| uses: oprypin/find-latest-tag@v1 | |
| with: | |
| repository: The-Academic-Observatory/coki-oa-web | |
| releases-only: true | |
| id: get_latest_tag | |
| - name: Set environment production | |
| if: github.event.action == 'data-update/production' | |
| run: | | |
| echo "COKI_ENVIRONMENT=production" >> $GITHUB_ENV | |
| echo "REPO_DISPATCH_REF=${{ steps.get_latest_tag.outputs.tag }}" >> $GITHUB_ENV | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ env.REPO_DISPATCH_REF }} | |
| - name: Current Checked Out Ref | |
| run: git symbolic-ref -q --short HEAD || git describe --tags --exact-match | |
| - name: Setup Environment | |
| uses: ./.github/actions/setup-environment | |
| with: | |
| bucket_name: ${{ secrets.BUCKET_NAME }} | |
| gcp_credentials: ${{ secrets.GCP_CREDENTIALS }} | |
| vercel: true | |
| download_images: true | |
| - name: Build App | |
| uses: ./.github/actions/build-app | |
| with: | |
| environment: ${{ env.COKI_ENVIRONMENT }} | |
| plausible_api_token: ${{ secrets.PLAUSIBLE_API_TOKEN }} | |
| wrangler_config: ${{ secrets.WRANGLER_CONFIG_API }} | |
| wrangler_config_images: ${{ secrets.WRANGLER_CONFIG_IMAGES }} | |
| cloudflare_api_token: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| vercel_org_id: ${{ secrets.VERCEL_ORG_ID }} | |
| vercel_project_id: ${{ secrets.VERCEL_PROJECT_ID }} | |
| vercel_token: ${{ secrets.VERCEL_TOKEN }} | |
| typekit_id: ${{ secrets.NEXT_PUBLIC_TYPEKIT_ID }} |