fix: gate mail preview + remove dead category route (#553) #1072
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: Deploy API to Dev (GitOps) | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| branches: [main] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' | |
| container: | |
| image: node:24-alpine | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run Unit Tests | |
| run: | | |
| export $(cat env-example-relational | grep -v '^#' | xargs) | |
| npm run test:ci | |
| env: | |
| NODE_OPTIONS: "--max_old_space_size=4096" | |
| e2e-test: | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| # Run in parallel with unit tests | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Checkout atproto-devnet | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: OpenMeet-Team/atproto-devnet | |
| path: atproto-devnet | |
| ref: v0.1.0 | |
| - name: Run e2e tests | |
| id: relational | |
| run: >- | |
| docker compose | |
| -f docker-compose.relational.ci.yaml | |
| -f atproto-devnet/docker-compose.yml | |
| -f docker-compose-ci-devnet.yml | |
| --env-file env-example-relational-ci | |
| -p ci-relational | |
| up --build --exit-code-from api | |
| - name: Copy prod.log from container to host | |
| if: ${{ failure() && steps.relational.conclusion == 'failure' }} | |
| run: docker cp ci-relational-api-1:/usr/src/app/prod.log . | |
| - name: Upload prod.log to artifacts for debugging | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: prod-logs | |
| path: prod.log | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| outputs: | |
| image_tag: ${{ steps.set-outputs.outputs.image_tag }} | |
| steps: | |
| - name: Checkout API repository | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v1 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ${{ vars.AWS_REGION || 'us-east-1' }} | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| with: | |
| mask-password: true | |
| - name: Set image tag | |
| id: set-outputs | |
| run: | | |
| echo "IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV | |
| echo "image_tag=${{ github.sha }}" >> $GITHUB_OUTPUT | |
| - name: Build, tag, and push image to Amazon ECR | |
| env: | |
| ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
| ECR_REPOSITORY: openmeet-ecr/openmeet-api | |
| GIT_REVISION: ${{ github.sha }} | |
| GIT_BRANCH: ${{ github.ref_name }} | |
| run: | | |
| echo "Building image with tag: $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" | |
| PACKAGE_JSON_B64=$(cat package.json | base64 -w 0) | |
| docker build --build-arg GIT_REVISION=$GIT_REVISION --build-arg GIT_BRANCH=$GIT_BRANCH --build-arg PACKAGE_JSON_B64=$PACKAGE_JSON_B64 -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
| docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
| # Tag as latest for main branch | |
| docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $ECR_REGISTRY/$ECR_REPOSITORY:latest | |
| docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest | |
| gitops-update: | |
| needs: [build-and-deploy] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| uses: ./.github/workflows/update-image-gitops.yml | |
| with: | |
| service_name: api | |
| image_tag: ${{ needs.build-and-deploy.outputs.image_tag }} | |
| environment: dev | |
| ecr_registry: 433321780850.dkr.ecr.us-east-1.amazonaws.com | |
| ecr_repository: openmeet-ecr/openmeet-api | |
| commit_message: "GitOps: Update API to ${{ needs.build-and-deploy.outputs.image_tag }} from main branch" | |
| secrets: | |
| GH_PAT: ${{ secrets.GH_PAT_INFRASTRUCTURE }} |