-
Notifications
You must be signed in to change notification settings - Fork 6
82 lines (78 loc) · 2.74 KB
/
user-api.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: User API
on:
# Only run the tests for this service when any of the following file paths change
pull_request:
paths:
- 'infrastructure/user-api/**'
- 'packages/**'
- 'docker-compose.yml'
- 'servers/user-api/**'
- 'pnpm-lock.yaml'
- 'Dockerfile'
- '.github/actions/**'
- '.github/workflows/user-api.yml'
- '.github/workflows/reuse-*.yml'
push:
branches:
- main
- dev
paths:
- 'infrastructure/user-api/**'
- 'packages/**'
- 'servers/user-api/**'
- 'pnpm-lock.yaml'
- 'Dockerfile'
- '.github/actions/**'
- '.github/workflows/user-api.yml'
- '.github/workflows/reuse-*.yml'
jobs:
# Let's test the service against some real life and mocked docker services.
test-integrations:
# Only run this job on a pull request event
if: github.event_name == 'pull_request'
# Use our re-usable test integrations workflow which will use our docker compose file
uses: ./.github/workflows/reuse-test-integrations.yml
with:
# Only run the tests for our service
scope: '@server/user-api'
# Ensure the re-usable workflow is allowed to access the secrets
secrets: inherit
apollo:
uses: ./.github/workflows/reuse-apollo-federation.yml
with:
federated-graph-name: pocket-client-api
graph-name: user
schema-file-path: servers/user-api/schema.graphql
prod-graph-url: https://user-api.readitlater.com
dev-graph-url: https://user-api.getpocket.dev
secrets:
apollo-key: ${{ secrets.APOLLO_CLIENT_API_KEY }}
# It's infrastructure time, run the infrastructure update commands
infrastructure:
uses: ./.github/workflows/reuse-infrastructure.yml
with:
scope: '@infrastructure/user-api'
stack-output-path: infrastructure/user-api/cdktf.out/stacks/user-api
# Ensure the re-usable workflow is allowed to access the secrets
secrets: inherit
# Let's try building and conidtionally pushing our docker image to the necessary account.
api:
uses: ./.github/workflows/reuse-build-and-push-image.yml
needs: [infrastructure]
with:
scope: '@server/user-api'
app-path: servers/user-api
app-port: 4006
sentry-project: user-api
docker-repo-name-pattern: userapi-{0}-app
terraform-output: ${{needs.infrastructure.outputs.terraform-output}}
# Ensure the re-usable workflow is allowed to access the secrets
secrets: inherit
sentry:
if: github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/main'
uses: ./.github/workflows/reuse-sentry-release.yml
needs: [api]
with:
sentry-project: user-api
sentry-environment: ${{ github.ref == 'refs/heads/main' && 'production' || 'development' }}
secrets: inherit