Build #3710
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: Build | |
| on: | |
| pull_request: | |
| types: [opened] | |
| branches: | |
| - "release-please--**" | |
| push: | |
| branches: | |
| - "release-please--**" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| env: | |
| PARABOL_DOCKERFILE: ./docker/images/parabol-ubi/dockerfiles/basic.dockerfile | |
| PARABOL_BUILD_ENV_PATH: docker/images/parabol-ubi/environments/pipeline | |
| jobs: | |
| build: | |
| runs-on: ubuntu-8cores | |
| timeout-minutes: 30 | |
| permissions: | |
| contents: "read" | |
| id-token: "write" | |
| services: | |
| postgres: | |
| image: pgvector/pgvector:0.8.0-pg16 | |
| # This env variables must be the same in the file PARABOL_BUILD_ENV_PATH | |
| env: | |
| POSTGRES_PASSWORD: "temppassword" | |
| POSTGRES_USER: "tempuser" | |
| POSTGRES_DB: "tempdb" | |
| ports: | |
| - 5432:5432 | |
| valkey: | |
| image: valkey/valkey:9.0-alpine | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup environment variables | |
| run: | | |
| ACTION_VERSION=$(grep '"version":' package.json | cut -d\" -f4) | |
| echo "ACTION_VERSION=${ACTION_VERSION}" >> $GITHUB_ENV | |
| echo "NODE_VERSION=$(jq -r -j '.engines.node|ltrimstr("^")' package.json)" >> $GITHUB_ENV | |
| DOCKER_REPOSITORY_FOR_REF=${{ secrets.GCP_AR_PARABOL_DEV }} | |
| echo "DOCKER_REPOSITORY_FOR_REF=${{ secrets.GCP_AR_PARABOL_DEV }}" >> $GITHUB_ENV | |
| corepack enable | |
| - name: Setup Node | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version-file: package.json | |
| cache: "pnpm" | |
| - name: Get cached node modules | |
| id: cache | |
| uses: actions/cache@v3 | |
| with: | |
| path: | | |
| **/node_modules | |
| key: node_modules-${{ runner.arch }}-${{ env.NODE_VERSION }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install node_modules | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| # pnpm has a bug that resolves git+https to ssh | |
| run: | | |
| git config --global url."https://github.com/enahum/redux-offline.git".insteadOf git@github.com:enahum/redux-offline.git | |
| pnpm install --frozen-lockfile | |
| - name: Build the DBs | |
| run: | | |
| cp ${{ env.PARABOL_BUILD_ENV_PATH }} ./.env | |
| pnpm kysely migrate:latest | |
| pnpm pg:generate | |
| - name: Build for release | |
| env: | |
| NODE_OPTIONS: "--max_old_space_size=8192" | |
| run: pnpm build --no-deps | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v2 | |
| with: | |
| buildkitd-flags: "--allow-insecure-entitlement network.host" | |
| driver-opts: network=host | |
| - id: "auth" | |
| name: "Authenticate to Google Cloud" | |
| uses: "google-github-actions/auth@v1" | |
| with: | |
| token_format: "access_token" | |
| workload_identity_provider: ${{ secrets.GCP_WI_PROVIDER_NAME }} | |
| service_account: ${{ secrets.GCP_SA_EMAIL }} | |
| - uses: "docker/login-action@v2" | |
| with: | |
| registry: ${{ secrets.GCP_DOCKER_REGISTRY }} | |
| username: "oauth2accesstoken" | |
| password: "${{ steps.auth.outputs.access_token }}" | |
| - name: Push build to dev | |
| uses: docker/build-push-action@v4 | |
| with: | |
| network: host | |
| allow: network.host | |
| provenance: false | |
| file: ${{ env.PARABOL_DOCKERFILE }} | |
| context: . | |
| build-args: | | |
| "_NODE_VERSION=${{ env.NODE_VERSION }}" | |
| "DD_GIT_REPOSITORY_URL=${{ github.repositoryUrl }}" | |
| "DD_GIT_COMMIT_SHA=${{ github.sha }}" | |
| push: true | |
| tags: | | |
| "${{ secrets.GCP_AR_PARABOL_DEV }}:${{github.sha}}" | |
| - name: Push Client Artifacts to Datadog | |
| env: | |
| DATADOG_API_KEY: "${{secrets.DATADOG_API_KEY}}" | |
| CDN_BUILD_URL: "https://action-files.parabol.co/production/" | |
| run: | | |
| pnpm datadog-ci sourcemaps upload ./build \ | |
| --service=parabol-saas-production \ | |
| --release-version=${{env.ACTION_VERSION}} \ | |
| --minified-path-prefix=${{env.CDN_BUILD_URL}} | |
| - name: Push Server Artifacts to Datadog | |
| env: | |
| DATADOG_API_KEY: "${{secrets.DATADOG_API_KEY}}" | |
| run: | | |
| pnpm datadog-ci sourcemaps upload ./dist \ | |
| --service=web \ | |
| --release-version=${{env.ACTION_VERSION}} \ | |
| --minified-path-prefix="/home/node/parabol/dist/" | |
| - name: Report Status | |
| if: failure() | |
| uses: ravsamhq/notify-slack-action@v2 | |
| with: | |
| status: ${{ job.status }} | |
| notify_when: "failure" | |
| env: | |
| SLACK_WEBHOOK_URL: ${{ secrets.SLACK_GH_ACTIONS_NOTIFICATIONS }} |