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