-
Notifications
You must be signed in to change notification settings - Fork 4
96 lines (87 loc) · 3.19 KB
/
initialize.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Initialize environments
on: [workflow_dispatch]
env:
DOCKER_TAG: initialize-run-${{ github.run_number }}
jobs:
prebuild:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.matrix.outputs.matrix }}
steps:
- uses: "actions/checkout@v3"
- uses: ./.github/actions/services-matrix
id: "matrix"
build-staging:
needs: prebuild
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.prebuild.outputs.matrix) }}
steps:
- uses: "actions/checkout@v3"
- name: "Configure env variables"
run: |
project="${{ vars.FVST_PROJECT_PREFIX }}-fvst-staging"
registry="us-docker.pkg.dev/$project/registry"
echo "project=$project" >> $GITHUB_ENV
echo "registry=$registry" >> $GITHUB_ENV
- uses: ./.github/actions/build-docker-container
with:
google_cloud_token: ${{ secrets.GOOGLE_CLOUD_TOKEN_STAGING }}
turborepo_cache_bucket: ${{ vars.FVST_PROJECT_TURBOREPO_BUCKET_STAGING }}
registry: ${{ env.registry }}
service: ${{ matrix.service }}
dockerfile: ${{ matrix.dockerfile }}
tag: ${{ env.DOCKER_TAG }}
deploy-staging:
needs: build-staging
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v3"
- uses: ./.github/actions/setup-google-cloud-auth
id: "auth"
with:
google_cloud_token: ${{ secrets.GOOGLE_CLOUD_TOKEN_STAGING }}
- uses: ./.github/actions/terraform-apply
with:
environment: "staging"
terraform-bucket: ${{ vars.FVST_PROJECT_TF_STATE_BUCKET_STAGING }}
region: ${{ vars.FVST_PROJECT_REGION }}
prefix: ${{ vars.FVST_PROJECT_PREFIX }}
docker-tag: ${{ env.DOCKER_TAG }}
build-production:
needs: prebuild
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJSON(needs.prebuild.outputs.matrix) }}
steps:
- uses: "actions/checkout@v3"
- name: "Configure env variables"
run: |
project="${{ vars.FVST_PROJECT_PREFIX }}-fvst-production"
registry="us-docker.pkg.dev/$project/registry"
echo "project=$project" >> $GITHUB_ENV
echo "registry=$registry" >> $GITHUB_ENV
- uses: ./.github/actions/build-docker-container
with:
google_cloud_token: ${{ secrets.GOOGLE_CLOUD_TOKEN_PRODUCTION }}
turborepo_cache_bucket: ${{ vars.FVST_PROJECT_TURBOREPO_BUCKET_PRODUCTION }}
registry: ${{ env.registry }}
service: ${{ matrix.service }}
dockerfile: ${{ matrix.dockerfile }}
tag: ${{ env.DOCKER_TAG }}
deploy-production:
needs: build-production
runs-on: ubuntu-latest
steps:
- uses: "actions/checkout@v3"
- uses: ./.github/actions/setup-google-cloud-auth
id: "auth"
with:
google_cloud_token: ${{ secrets.GOOGLE_CLOUD_TOKEN_PRODUCTION }}
- uses: ./.github/actions/terraform-apply
with:
environment: "production"
terraform-bucket: ${{ vars.FVST_PROJECT_TF_STATE_BUCKET_PRODUCTION }}
region: ${{ vars.FVST_PROJECT_REGION }}
prefix: ${{ vars.FVST_PROJECT_PREFIX }}
docker-tag: ${{ env.DOCKER_TAG }}