@@ -2,15 +2,63 @@ name: Integration Test
2
2
3
3
on :
4
4
pull_request :
5
+ push :
6
+ branches :
7
+ - main
8
+ workflow_dispatch :
9
+
10
+ env :
11
+ AWS_DEFAULT_REGION : us-east-1
5
12
6
13
jobs :
7
14
build :
8
15
runs-on : ubuntu-latest
16
+ permissions :
17
+ contents : read
18
+ id-token : write
19
+
9
20
steps :
10
- - uses : actions/checkout@v3
21
+ - uses : actions/checkout@v4
11
22
with :
12
23
fetch-depth : 0
13
24
25
+ - name : Configure AWS credentials
26
+ if : github.event_name != 'pull_request'
27
+ uses : aws-actions/configure-aws-credentials@v4
28
+ with :
29
+ aws-access-key-id : ${{ secrets.AWS_ACCESS_KEY_ID }}
30
+ aws-secret-access-key : ${{ secrets.AWS_SECRET_ACCESS_KEY }}
31
+ aws-region : ${{ env.AWS_DEFAULT_REGION }}
32
+
33
+ - name : Login to Amazon ECR
34
+ if : github.event_name != 'pull_request'
35
+ id : login-ecr
36
+ uses : aws-actions/amazon-ecr-login@v2
37
+
38
+ - name : Set up Docker Buildx
39
+ uses : docker/setup-buildx-action@v3
40
+
41
+ - name : Determine ECR image tags
42
+ id : meta
43
+ uses : docker/metadata-action@v5
44
+ with :
45
+ images : ${{ steps.login-ecr.outputs.registry }}/cov-diff-action
46
+ tags : |
47
+ type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
48
+ type=sha
49
+ type=semver,pattern=v{{version}},event=tag
50
+
51
+ - name : Build and Push Docker image to ECR
52
+ id : build_and_push
53
+ uses : docker/build-push-action@v6
54
+ with :
55
+ context : .
56
+ file : ./Dockerfile
57
+ push : ${{ github.event_name != 'pull_request' }}
58
+ tags : ${{ steps.meta.outputs.tags }}
59
+ cache-from : type=gha,scope=${{ github.workflow }}
60
+ cache-to : type=gha,mode=max,scope=${{ github.workflow }}
61
+
14
62
- name : run tests
15
63
run : |
16
64
go test ./... -coverprofile=coverage.out
0 commit comments