@@ -2,12 +2,25 @@ name: Integration Test
22
33on :
44 pull_request :
5+ push :
6+ branches :
7+ - main
8+ tags :
9+ - ' v*.*.*'
10+ workflow_dispatch :
11+
12+ env :
13+ AWS_DEFAULT_REGION : us-east-1
514
615jobs :
7- build :
16+ test :
817 runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
20+ pull-requests : write
21+
922 steps :
10- - uses : actions/checkout@v3
23+ - uses : actions/checkout@v4
1124 with :
1225 fetch-depth : 0
1326
2841 diff : pr.diff
2942 module : github.com/panagiotisptr/cov-diff
3043
31- - name : Comment
44+ - name : Comment on PR
3245 uses : mshick/add-pr-comment@v2
3346 with :
3447 message : |
3548 Coverage on new code: ${{ steps.selftest.outputs.covdiff }}%
49+
50+ build_push :
51+ needs : test
52+ runs-on : ubuntu-latest
53+ permissions :
54+ contents : read
55+ id-token : write
56+
57+ steps :
58+ - uses : actions/checkout@v4
59+ with :
60+ fetch-depth : 0
61+
62+ - name : Configure AWS credentials
63+ if : github.event_name != 'pull_request'
64+ uses : aws-actions/configure-aws-credentials@v4
65+ with :
66+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
67+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
68+ aws-region : ${{ env.AWS_DEFAULT_REGION }}
69+
70+ - name : Login to Amazon ECR
71+ if : github.event_name != 'pull_request'
72+ id : login-ecr
73+ uses : aws-actions/amazon-ecr-login@v2
74+
75+ - name : Set up Docker Buildx
76+ uses : docker/setup-buildx-action@v3
77+
78+ - name : Determine ECR image tags
79+ id : meta
80+ uses : docker/metadata-action@v5
81+ with :
82+ images : |
83+ ${{ steps.login-ecr.outputs.registry && format('{0}/', steps.login-ecr.outputs.registry) || '' }}cov-diff
84+ tags : |
85+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
86+ type=sha
87+ type=semver,pattern=v{{version}},event=tag
88+
89+ - name : Build and Push Docker image to ECR
90+ id : build_and_push
91+ uses : docker/build-push-action@v6
92+ with :
93+ context : .
94+ file : ./Dockerfile
95+ push : ${{ github.event_name != 'pull_request' }}
96+ tags : ${{ steps.meta.outputs.tags }}
97+ cache-from : type=gha,scope=${{ github.workflow }}
98+ cache-to : type=gha,mode=max,scope=${{ github.workflow }}
0 commit comments