@@ -7,6 +7,7 @@ import Intro from '@site/src/components/Intro';
77import KeyPoints from ' @site/src/components/KeyPoints' ;
88import Tabs from ' @theme/Tabs' ;
99import TabItem from ' @theme/TabItem' ;
10+ import CollapsibleText from ' @site/src/components/CollapsibleText' ;
1011
1112<Intro >
1213 We use the [ ` ecspresso ` ] ( https://github.com/kayac/ecspresso ) deployment tool for Amazon ECS to manage ECS services using a code-driven approach, alongside reusable GitHub Action workflows. This setup allows tasks to be defined with Terraform within the infrastructure repository, and task definitions to reside alongside the application code. Ecspresso provides extensive configuration options via YAML, JSON, and Jsonnet, and includes plugins for enhanced functionality such as Terraform state lookups.
@@ -57,192 +58,192 @@ sequenceDiagram
5758
5859### Github Action Workflows
5960
60- The basic deployment flow is for feature branches. You can use the following
61- sample workflow to add pull request deploys to your application repository:
61+ The basic deployment flow is for feature branches. You can use the following sample workflow to add pull request deploys to your application repository:
6262
63- <details >
64- <summary >Deploy</summary >
63+ :::tip Latest Examples
6564
66- <Tabs queryString = " workflow" >
67-
68- <TabItem value = " feature" label = " Feature" >
69-
70- ``` yaml
71- name : Feature Branch
72- on :
73- pull_request :
74- branches : [ 'main' ]
75- types : [opened, synchronize, reopened, closed, labeled, unlabeled]
76-
77- permissions :
78- pull-requests : write
79- deployments : write
80- id-token : write
81- contents : read
82-
83- concurrency :
84- group : ${{ github.workflow }}-${{ github.ref }}
85- cancel-in-progress : false
86-
87- jobs :
88- monorepo :
89- uses : cloudposse/github-actions-workflows/.github/workflows/controller-monorepo.yml@main
90- with :
91- file : ./deploy/config.yaml
92-
93- ci :
94- uses : cloudposse/github-actions-workflows/.github/workflows/ci-dockerized-app-build.yml@main
95- needs : [ monorepo ]
96- with :
97- organization : " cloudposse"
98- repository : ${{ github.event.repository.name }}
99- secrets :
100- ecr-region : ${{ secrets.ECR_REGION }}
101- ecr-iam-role : ${{ secrets.ECR_IAM_ROLE }}
102- registry : ${{ secrets.ECR_REGISTRY }}
103- secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
104-
105- cd :
106- uses : cloudposse/github-actions-workflows/.github/workflows/cd-preview-ecspresso.yml@main
107- needs : [ ci, monorepo ]
108- if : ${{ always() && needs.monorepo.outputs.apps != '[]' }}
109- strategy :
110- matrix :
111- app : ${{ fromJson(needs.monorepo.outputs.apps) }}
112- with :
113- image : ${{ needs.ci.outputs.image }}
114- tag : ${{ needs.ci.outputs.tag }}
115- repository : ${{ github.event.repository.name }}
116- app : ${{ matrix.app }}
117- open : ${{ github.event.pull_request.state == 'open' }}
118- labels : ${{ toJSON(github.event.pull_request.labels.*.name) }}
119- ref : ${{ github.event.pull_request.head.ref }}
120- exclusive : true
121- enable-migration : ${{ contains(fromJSON(needs.monorepo.outputs.migrations), matrix.app) }}
122- settings : ${{ needs.monorepo.outputs.settings }}
123- env-label : |
124- qa1: deploy/qa1
125- secrets :
126- secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
127- ` ` `
65+ Check out our [ example app-on-ecs] ( https://github.com/cloudposse-examples/app-on-ecs ) for the latest example of how to use ` ecspresso ` with GitHub Actions.
12866
129- </TabItem>
130-
131- <TabItem value="main" label="Main">
132-
133- ` ` ` yaml
134- name : 2 - Main Branch
135- on :
136- push :
137- branches : [ main ]
138-
139- permissions :
140- contents : write
141- id-token : write
142- pull-requests : read
143-
144- concurrency :
145- group : ${{ github.workflow }}-${{ github.ref }}
146- cancel-in-progress : false
147-
148- jobs :
149- monorepo :
150- uses : cloudposse/github-actions-workflows/.github/workflows/controller-monorepo.yml@main
151- with :
152- file : ./deploy/config.yaml
153-
154- ci :
155- uses : cloudposse/github-actions-workflows/.github/workflows/ci-dockerized-app-build.yml@main
156- needs : [ monorepo ]
157- with :
158- organization : " cloudposse"
159- repository : ${{ github.event.repository.name }}
160- secrets :
161- ecr-region : ${{ secrets.ECR_REGION }}
162- ecr-iam-role : ${{ secrets.ECR_IAM_ROLE }}
163- registry : ${{ secrets.ECR_REGISTRY }}
164- secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
165-
166- cd :
167- uses : cloudposse/github-actions-workflows/.github/workflows/cd-ecspresso.yml@main
168- needs : [ ci, monorepo ]
169- strategy :
170- matrix :
171- app : ${{ fromJson(needs.monorepo.outputs.apps) }}
172- with :
173- image : ${{ needs.ci.outputs.image }}
174- tag : ${{ needs.ci.outputs.tag }}
175- repository : ${{ github.event.repository.name }}
176- app : ${{ matrix.app }}
177- environment : dev
178- enable-migration : ${{ contains(fromJSON(needs.monorepo.outputs.migrations), matrix.app) }}
179- settings : ${{ needs.monorepo.outputs.settings }}
180- secrets :
181- secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
182-
183- release :
184- uses : cloudposse/github-actions-workflows/.github/workflows/controller-draft-release.yml@main
185- needs : [ cd ]
186- ` ` `
67+ :::
18768
188- </TabItem>
189-
190- <TabItem value="release" label="Release">
191-
192- ` ` ` yaml
193- name : 3 - Release
194- on :
195- release :
196- types : [published]
197-
198- permissions :
199- id-token : write
200- contents : write
201-
202- concurrency :
203- group : ${{ github.workflow }}
204- cancel-in-progress : false
205-
206- jobs :
207- monorepo :
208- uses : cloudposse/github-actions-workflows/.github/workflows/controller-monorepo.yml@main
209- with :
210- file : ./deploy/config.yaml
211-
212- ci :
213- uses : cloudposse/github-actions-workflows/.github/workflows/ci-dockerized-app-promote.yml@main
214- needs : [ monorepo ]
215- with :
216- organization : " cloudposse"
217- repository : ${{ github.event.repository.name }}
218- version : ${{ github.event.release.tag_name }}
219- secrets :
220- ecr-region : ${{ secrets.ECR_REGION }}
221- ecr-iam-role : ${{ secrets.ECR_IAM_ROLE }}
222- registry : ${{ secrets.ECR_REGISTRY }}
223- secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
224-
225- cd :
226- uses : cloudposse/github-actions-workflows/.github/workflows/cd-ecspresso.yml@main
227- needs : [ ci, monorepo ]
228- strategy :
229- matrix :
230- app : ${{ fromJson(needs.monorepo.outputs.apps) }}
231- with :
232- image : ${{ needs.ci.outputs.image }}
233- tag : ${{ needs.ci.outputs.tag }}
234- repository : ${{ github.event.repository.name }}
235- app : ${{ matrix.app }}
236- environment : " staging"
237- enable-migration : ${{ contains(fromJSON(needs.monorepo.outputs.migrations), matrix.app) }}
238- settings : ${{ needs.monorepo.outputs.settings }}
239- secrets :
240- secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
241- ` ` `
242-
243- </TabItem>
69+ <Tabs queryString = " workflow" >
70+ <TabItem value = " feature" label = " Feature" >
71+ <CollapsibleText type = " medium" >
72+ ``` yaml title=".github/workflows/feature-branch.yaml"
73+ name : 1 - Feature Branch
74+ on :
75+ pull_request :
76+ branches : [ main ]
77+ types : [opened, synchronize, reopened, closed, labeled, unlabeled]
78+
79+ permissions :
80+ pull-requests : write
81+ deployments : write
82+ id-token : write
83+ contents : read
84+
85+ concurrency :
86+ group : ${{ github.workflow }}-${{ github.ref }}
87+ cancel-in-progress : false
88+
89+ jobs :
90+ monorepo :
91+ uses : cloudposse/github-actions-workflows/.github/workflows/controller-monorepo.yml@main
92+ with :
93+ file : ./deploy/config.yaml
94+
95+ ci :
96+ uses : cloudposse/github-actions-workflows/.github/workflows/ci-dockerized-app-build.yml@main
97+ needs : [ monorepo ]
98+ with :
99+ organization : " cloudposse"
100+ repository : ${{ github.event.repository.name }}
101+ secrets :
102+ ecr-region : ${{ secrets.ECR_REGION }}
103+ ecr-iam-role : ${{ secrets.ECR_IAM_ROLE }}
104+ registry : ${{ secrets.ECR_REGISTRY }}
105+ secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
106+
107+ cd :
108+ uses : cloudposse/github-actions-workflows/.github/workflows/cd-preview-ecspresso.yml@main
109+ needs : [ ci, monorepo ]
110+ if : ${{ always() && needs.monorepo.outputs.apps != '[]' }}
111+ strategy :
112+ matrix :
113+ app : ${{ fromJson(needs.monorepo.outputs.apps) }}
114+ with :
115+ image : ${{ needs.ci.outputs.image }}
116+ tag : ${{ needs.ci.outputs.tag }}
117+ repository : ${{ github.event.repository.name }}
118+ app : ${{ matrix.app }}
119+ open : ${{ github.event.pull_request.state == 'open' }}
120+ labels : ${{ toJSON(github.event.pull_request.labels.*.name) }}
121+ ref : ${{ github.event.pull_request.head.ref }}
122+ exclusive : true
123+ enable-migration : ${{ contains(fromJSON(needs.monorepo.outputs.migrations), matrix.app) }}
124+ settings : ${{ needs.monorepo.outputs.settings }}
125+ env-label : |
126+ qa1: deploy/qa1
127+ secrets :
128+ secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
129+ ` ` `
130+ </CollapsibleText>
131+ </TabItem>
132+
133+ <TabItem value="main" label="Main">
134+ <CollapsibleText type="medium">
135+ ` ` ` yaml title=".github/workflows/main-branch.yaml"
136+ name : 2 - Main Branch
137+ on :
138+ push :
139+ branches : [ main ]
140+
141+ permissions :
142+ contents : write
143+ id-token : write
144+ pull-requests : read
145+
146+ concurrency :
147+ group : ${{ github.workflow }}-${{ github.ref }}
148+ cancel-in-progress : false
149+
150+ jobs :
151+ monorepo :
152+ uses : cloudposse/github-actions-workflows/.github/workflows/controller-monorepo.yml@main
153+ with :
154+ file : ./deploy/config.yaml
155+
156+ ci :
157+ uses : cloudposse/github-actions-workflows/.github/workflows/ci-dockerized-app-build.yml@main
158+ needs : [ monorepo ]
159+ with :
160+ organization : " cloudposse"
161+ repository : ${{ github.event.repository.name }}
162+ secrets :
163+ ecr-region : ${{ secrets.ECR_REGION }}
164+ ecr-iam-role : ${{ secrets.ECR_IAM_ROLE }}
165+ registry : ${{ secrets.ECR_REGISTRY }}
166+ secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
167+
168+ cd :
169+ uses : cloudposse/github-actions-workflows/.github/workflows/cd-ecspresso.yml@main
170+ needs : [ ci, monorepo ]
171+ strategy :
172+ matrix :
173+ app : ${{ fromJson(needs.monorepo.outputs.apps) }}
174+ with :
175+ image : ${{ needs.ci.outputs.image }}
176+ tag : ${{ needs.ci.outputs.tag }}
177+ repository : ${{ github.event.repository.name }}
178+ app : ${{ matrix.app }}
179+ environment : dev
180+ enable-migration : ${{ contains(fromJSON(needs.monorepo.outputs.migrations), matrix.app) }}
181+ settings : ${{ needs.monorepo.outputs.settings }}
182+ secrets :
183+ secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
184+
185+ release :
186+ uses : cloudposse/github-actions-workflows/.github/workflows/controller-draft-release.yml@main
187+ needs : [ cd ]
188+ ` ` `
189+ </CollapsibleText>
190+ </TabItem>
191+
192+ <TabItem value="release" label="Release">
193+ <CollapsibleText type="medium">
194+ ` ` ` yaml title=".github/workflows/release.yaml"
195+ name : 3 - Release
196+ on :
197+ release :
198+ types : [published]
199+
200+ permissions :
201+ id-token : write
202+ contents : write
203+
204+ concurrency :
205+ group : ${{ github.workflow }}
206+ cancel-in-progress : false
207+
208+ jobs :
209+ monorepo :
210+ uses : cloudposse/github-actions-workflows/.github/workflows/controller-monorepo.yml@main
211+ with :
212+ file : ./deploy/config.yaml
213+
214+ ci :
215+ uses : cloudposse/github-actions-workflows/.github/workflows/ci-dockerized-app-promote.yml@main
216+ needs : [ monorepo ]
217+ with :
218+ organization : " cloudposse"
219+ repository : ${{ github.event.repository.name }}
220+ version : ${{ github.event.release.tag_name }}
221+ secrets :
222+ ecr-region : ${{ secrets.ECR_REGION }}
223+ ecr-iam-role : ${{ secrets.ECR_IAM_ROLE }}
224+ registry : ${{ secrets.ECR_REGISTRY }}
225+ secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
226+
227+ cd :
228+ uses : cloudposse/github-actions-workflows/.github/workflows/cd-ecspresso.yml@main
229+ needs : [ ci, monorepo ]
230+ strategy :
231+ matrix :
232+ app : ${{ fromJson(needs.monorepo.outputs.apps) }}
233+ with :
234+ image : ${{ needs.ci.outputs.image }}
235+ tag : ${{ needs.ci.outputs.tag }}
236+ repository : ${{ github.event.repository.name }}
237+ app : ${{ matrix.app }}
238+ environment : " staging"
239+ enable-migration : ${{ contains(fromJSON(needs.monorepo.outputs.migrations), matrix.app) }}
240+ settings : ${{ needs.monorepo.outputs.settings }}
241+ secrets :
242+ secret-outputs-passphrase : ${{ secrets.GHA_SECRET_OUTPUT_PASSPHRASE }}
243+ ` ` `
244+ </CollapsibleText>
245+ </TabItem>
244246</Tabs>
245- </details>
246247
247248## References
248249- [Ecspresso](https://github.com/kayac/ecspresso) : Tool repo
0 commit comments