Skip to content

Commit bf95364

Browse files
committed
Merge branch 'main' into symphony/FIR-29
# Conflicts: # apps/api/src/main.py # apps/api/src/tags/models.py # apps/web/src/components/ui/avatar.tsx # apps/web/src/components/ui/card.tsx
2 parents 83387e0 + bb8ee21 commit bf95364

88 files changed

Lines changed: 6450 additions & 56 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/dependabot.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,18 @@ updates:
3939
- minor
4040
- patch
4141

42+
- package-ecosystem: terraform
43+
directory: /infra
44+
schedule:
45+
interval: weekly
46+
day: monday
47+
open-pull-requests-limit: 5
48+
labels:
49+
- dependencies
50+
- infrastructure
51+
4252
- package-ecosystem: docker
43-
directory: /
53+
directory: /apps/api
4454
schedule:
4555
interval: monthly
4656
open-pull-requests-limit: 5

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
mobile: ${{ steps.filter.outputs.mobile }}
2323
steps:
2424
- uses: actions/checkout@v4
25-
- uses: dorny/paths-filter@v3
25+
- uses: dorny/paths-filter@v4
2626
id: filter
2727
with:
2828
filters: |

.github/workflows/deploy-api.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Deploy API
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'apps/api/**'
8+
9+
concurrency:
10+
group: deploy-api
11+
cancel-in-progress: false
12+
13+
env:
14+
GCP_PROJECT_ID: ${{ vars.GCP_PROJECT_ID }}
15+
GCP_REGION: ${{ vars.GCP_REGION }}
16+
GAR_REPOSITORY: globe-crm
17+
SERVICE_NAME: globe-crm-api
18+
WORKLOAD_IDENTITY_PROVIDER: ${{ vars.WORKLOAD_IDENTITY_PROVIDER }}
19+
SERVICE_ACCOUNT: ${{ vars.GCP_SERVICE_ACCOUNT }}
20+
21+
jobs:
22+
deploy:
23+
name: Build & Deploy
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: read
27+
id-token: write # Required for OIDC
28+
steps:
29+
- uses: actions/checkout@v4
30+
31+
- id: auth
32+
uses: google-github-actions/auth@v2
33+
with:
34+
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
35+
service_account: ${{ env.SERVICE_ACCOUNT }}
36+
37+
- uses: google-github-actions/setup-gcloud@v2
38+
39+
- name: Configure Docker for Artifact Registry
40+
run: gcloud auth configure-docker ${{ env.GCP_REGION }}-docker.pkg.dev --quiet
41+
42+
- name: Build and push Docker image
43+
id: build
44+
run: |
45+
IMAGE="${{ env.GCP_REGION }}-docker.pkg.dev/${{ env.GCP_PROJECT_ID }}/${{ env.GAR_REPOSITORY }}/${{ env.SERVICE_NAME }}"
46+
TAG="${{ github.sha }}"
47+
docker build -t "${IMAGE}:${TAG}" -t "${IMAGE}:latest" apps/api
48+
docker push "${IMAGE}:${TAG}"
49+
docker push "${IMAGE}:latest"
50+
echo "image=${IMAGE}:${TAG}" >> "$GITHUB_OUTPUT"
51+
52+
- name: Deploy to Cloud Run
53+
uses: google-github-actions/deploy-cloudrun@v2
54+
with:
55+
service: ${{ env.SERVICE_NAME }}
56+
region: ${{ env.GCP_REGION }}
57+
image: ${{ steps.build.outputs.image }}

.github/workflows/terraform.yml

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Terraform
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'infra/**'
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- 'infra/**'
12+
13+
concurrency:
14+
group: terraform-${{ github.ref }}
15+
cancel-in-progress: false
16+
17+
env:
18+
TF_WORKING_DIR: infra
19+
WORKLOAD_IDENTITY_PROVIDER: ${{ vars.WORKLOAD_IDENTITY_PROVIDER }}
20+
SERVICE_ACCOUNT: ${{ vars.GCP_SERVICE_ACCOUNT }}
21+
22+
jobs:
23+
terraform:
24+
name: ${{ github.event_name == 'pull_request' && 'Plan' || 'Apply' }}
25+
runs-on: ubuntu-latest
26+
permissions:
27+
contents: read
28+
id-token: write
29+
pull-requests: write # For PR comments
30+
steps:
31+
- uses: actions/checkout@v4
32+
33+
- id: auth
34+
uses: google-github-actions/auth@v2
35+
with:
36+
workload_identity_provider: ${{ env.WORKLOAD_IDENTITY_PROVIDER }}
37+
service_account: ${{ env.SERVICE_ACCOUNT }}
38+
39+
- uses: hashicorp/setup-terraform@v3
40+
41+
- name: Terraform Init
42+
run: terraform init
43+
working-directory: ${{ env.TF_WORKING_DIR }}
44+
45+
- name: Terraform Format Check
46+
run: terraform fmt -check -recursive
47+
working-directory: ${{ env.TF_WORKING_DIR }}
48+
49+
- name: Terraform Validate
50+
run: terraform validate
51+
working-directory: ${{ env.TF_WORKING_DIR }}
52+
53+
- name: Terraform Plan
54+
id: plan
55+
run: terraform plan -no-color -out=tfplan
56+
working-directory: ${{ env.TF_WORKING_DIR }}
57+
58+
- name: Comment Plan on PR
59+
if: github.event_name == 'pull_request'
60+
uses: actions/github-script@v7
61+
with:
62+
script: |
63+
const plan = `${{ steps.plan.outputs.stdout }}`;
64+
const truncated = plan.length > 60000 ? plan.substring(0, 60000) + '\n\n... (truncated)' : plan;
65+
const body = [
66+
'#### Terraform Plan',
67+
'',
68+
'<details><summary>Show Plan</summary>',
69+
'',
70+
'```terraform',
71+
truncated,
72+
'```',
73+
'',
74+
'</details>',
75+
'',
76+
`*Pushed by: @${{ github.actor }}, Action: \`${{ github.event_name }}\`*`,
77+
].join('\n');
78+
79+
const { data: comments } = await github.rest.issues.listComments({
80+
owner: context.repo.owner,
81+
repo: context.repo.repo,
82+
issue_number: context.issue.number,
83+
});
84+
85+
const botComment = comments.find(c => c.body?.includes('Terraform Plan'));
86+
if (botComment) {
87+
await github.rest.issues.updateComment({
88+
owner: context.repo.owner,
89+
repo: context.repo.repo,
90+
comment_id: botComment.id,
91+
body,
92+
});
93+
} else {
94+
await github.rest.issues.createComment({
95+
owner: context.repo.owner,
96+
repo: context.repo.repo,
97+
issue_number: context.issue.number,
98+
body,
99+
});
100+
}
101+
102+
- name: Terraform Apply
103+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
104+
run: terraform apply -auto-approve tfplan
105+
working-directory: ${{ env.TF_WORKING_DIR }}

CODEOWNERS

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,23 @@
66
# when someone opens a pull request that modifies matching files.
77

88
# Default owner for everything in the repo
9-
* @globe-crm/core
9+
* @gracefullight
1010

1111
# Frontend
12-
/src/app/ @globe-crm/frontend
13-
/src/components/ @globe-crm/frontend
14-
/src/hooks/ @globe-crm/frontend
15-
/src/styles/ @globe-crm/frontend
12+
/src/app/ @gracefullight
13+
/src/components/ @gracefullight
14+
/src/hooks/ @gracefullight
15+
/src/styles/ @gracefullight
1616

1717
# Backend
18-
/src/api/ @globe-crm/backend
19-
/src/services/ @globe-crm/backend
20-
/src/lib/ @globe-crm/backend
18+
/src/api/ @gracefullight
19+
/src/services/ @gracefullight
20+
/src/lib/ @gracefullight
2121

2222
# Data
23-
/src/db/ @globe-crm/data
24-
/prisma/ @globe-crm/data
25-
/migrations/ @globe-crm/data
23+
/src/db/ @gracefullight
24+
/prisma/ @gracefullight
25+
/migrations/ @gracefullight
2626

2727
# CI/CD
28-
/.github/ @globe-crm/core
28+
/.github/ @gracefullight

0 commit comments

Comments
 (0)