1
1
# Copyright 2020 ChainSafe Systems
2
2
# SPDX-License-Identifier: LGPL-3.0-only
3
3
4
- name : Release
4
+ name : Build & Deploy PROD
5
+
5
6
on :
6
7
push :
7
- branches :
8
- - main
8
+ tags :
9
+ - ' v*'
10
+ workflow_dispatch :
9
11
10
12
env :
11
13
AWS_REGION : ${{ secrets.AWS_REGION }}
14
16
ECS_CLUSTER : ${{ secrets.AWS_ECS_CLUSTER }}
15
17
ECS_SERVICE : ${{ secrets.AWS_ECS_SERVICE }}
16
18
ENVIRONMENT : PROD
17
-
19
+
18
20
jobs :
19
- release-please :
21
+ build :
22
+ name : build_deploy_prod
20
23
runs-on : ubuntu-latest
21
24
permissions :
22
25
id-token : write
23
26
contents : write
24
27
25
28
steps :
26
- -
uses :
GoogleCloudPlatform/[email protected]
27
- id : release
28
- with :
29
- release-type : go
30
-
29
+ # download the source code into the runner
31
30
- name : checkout
32
31
uses : actions/checkout@v2
33
- if : ${{ steps.release.outputs.release_created }}
34
-
32
+
35
33
- name : Set output
36
34
id : vars
37
35
run : echo ::set-output name=tag::${GITHUB_REF#refs/*/}
38
- if : ${{ steps.release.outputs.release_created }}
39
-
36
+
40
37
- name : Configure AWS credentials
41
38
uses : aws-actions/configure-aws-credentials@v1
42
39
with :
43
40
role-to-assume : arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/github-actions-role
44
41
aws-region : ${{ env.AWS_REGION }}
45
- if : ${{ steps.release.outputs.release_created }}
46
42
47
43
# gather metadata from git & github actions to reference in docker
48
44
- name : git & github metadata
49
45
id : metadata
50
46
uses : docker/metadata-action@v3
51
47
with :
52
48
images : ${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.AWS_ECR_REPO }}
53
- if : ${{ steps.release.outputs.release_created }}
54
49
55
50
# login in docker repository
56
51
- name : docker login
57
52
uses : aws-actions/amazon-ecr-login@v1
58
- if : ${{ steps.release.outputs.release_created }}
59
53
60
54
# build a docker image
61
55
- name : docker & push image
67
61
tags : |
68
62
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:latest
69
63
${{ env.AWS_ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com/${{ env.ECR_REPO }}:${{ steps.vars.outputs.tag }}
70
- if : ${{ steps.release.outputs.release_created }}
71
-
64
+
72
65
# deploy to AWS ECS
73
66
- name : Deploy to Amazon ECS
74
67
uses : aws-actions/amazon-ecs-deploy-task-definition@v1
77
70
service : ${{ env.ECS_SERVICE }}
78
71
cluster : ${{ env.ECS_CLUSTER }}
79
72
wait-for-service-stability : true
80
- if : ${{ steps.release.outputs.release_created }}
81
-
73
+
0 commit comments