-
Notifications
You must be signed in to change notification settings - Fork 0
142 lines (123 loc) · 4.89 KB
/
build-and-deploy.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: Build and deploy
env:
terraform_state_s3_bucket: "orbs-terraform-tfstate"
terraform_state_s3_key_prefix: "order-book"
terraform_state_dynamodb_table: "orbs-terraform-locks"
build_path: "."
on:
push:
branches: ["main"]
paths:
- "**"
jobs:
build-server:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- name: Build server image and push to Heroku
uses: ./.github/actions/build-push-image
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "ob-server-development"
heroku_app_type: "web"
build-swaps-tracker:
runs-on: ubuntu-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- name: Build swaps tracker image and push to Heroku
uses: ./.github/actions/build-push-image
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
heroku_app_name: "ob-swaps-tracker-development"
heroku_app_type: "worker"
build-maker-mock:
runs-on: ubuntu-latest
needs: [build-server, build-swaps-tracker]
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- name: Login to Heroku Container Registry
run: heroku container:login
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Build and Push Docker Image
run: |
docker build -t registry.heroku.com/ob-maker-mock/worker -f e2e/maker/Dockerfile .
docker push registry.heroku.com/ob-maker-mock/worker
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Release Image
run: heroku container:release worker --app ob-maker-mock
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
deploy-development:
runs-on: ubuntu-latest
needs: [build-server, build-swaps-tracker, build-maker-mock]
environment: development
steps:
- name: Login to Heroku Container Registry
run: heroku container:login
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Pull and Release Image for Server Nonprod
run: |
heroku container:release web --app ob-server-development
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Pull and Release Image for Swaps Tracker Nonprod
run: |
heroku container:release worker --app ob-swaps-tracker-development
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
deploy-staging:
runs-on: ubuntu-latest
needs: deploy-development
environment: staging
steps:
- name: Login to Heroku Container Registry
run: heroku container:login
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Pull and Release Image for Server Staging
run: |
docker pull registry.heroku.com/ob-server-development/web
docker tag registry.heroku.com/ob-server-development/web registry.heroku.com/ob-server-staging/web
docker push registry.heroku.com/ob-server-staging/web
heroku container:release web --app ob-server-staging
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Pull and Release Image for Swaps Tracker Staging
run: |
docker pull registry.heroku.com/ob-swaps-tracker-development/worker
docker tag registry.heroku.com/ob-swaps-tracker-development/worker registry.heroku.com/ob-swaps-tracker-staging/worker
docker push registry.heroku.com/ob-swaps-tracker-staging/worker
heroku container:release worker --app ob-swaps-tracker-staging
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
deploy-production:
runs-on: ubuntu-latest
needs: [deploy-development, deploy-staging]
environment: production
steps:
- name: Login to Heroku Container Registry
run: heroku container:login
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Pull and Release Image for Server Production
run: |
docker pull registry.heroku.com/ob-server-staging/web
docker tag registry.heroku.com/ob-server-staging/web registry.heroku.com/ob-server-production/web
docker push registry.heroku.com/ob-server-production/web
heroku container:release web --app ob-server-production
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
- name: Pull and Release Image for Swaps Tracker Production
run: |
docker pull registry.heroku.com/ob-swaps-tracker-staging/worker
docker tag registry.heroku.com/ob-swaps-tracker-staging/worker registry.heroku.com/ob-swaps-tracker-production/worker
docker push registry.heroku.com/ob-swaps-tracker-production/worker
heroku container:release worker --app ob-swaps-tracker-production
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}