@@ -13,45 +13,28 @@ jobs:
13
13
- name : black
14
14
uses : psf/black@stable
15
15
16
- - name : Configure AWS credentials
17
- uses : aws-actions/configure-aws-credentials@v1-node16
16
+ - name : Log in to Docker Hub
17
+ uses : docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
18
18
with :
19
- role-to-assume : arn:aws:iam::200049542062:role/go_capture/GithubRole
20
- aws-region : us-west-1
19
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
20
+ password : ${{ secrets.DOCKERHUB_TOKEN }}
21
21
22
- - name : Set ECR Stack Name
23
- id : ecr-stack-name
24
- run : echo ECR_STACK_NAME=GoCaptureECR >> $GITHUB_OUTPUT
25
-
26
- - name : Deploy ECR repository
27
- uses : aws-actions/aws-cloudformation-github-deploy@v1
22
+ - name : Extract metadata (tags, labels) for Docker
23
+ id : meta
24
+ uses : docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
28
25
with :
29
- name : ${{ steps.ecr-stack-name.outputs.ECR_STACK_NAME }}
30
- template : cloud-formation/ecr.yaml
31
- no-fail-on-empty-changeset : 1
32
-
33
- - name : Beta Deploy User
34
- uses : aws-actions/aws-cloudformation-github-deploy@v1
26
+ images : codeguru42/go-capture
27
+ tags : |
28
+ type=raw,value=latest,enable={{is_default_branch}}
29
+ type=semver,pattern={{version}}
30
+ type=semver,pattern={{major}}.{{minor}}
31
+ type=sha
32
+
33
+ - name : Build and push Docker image
34
+ uses : docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
35
35
with :
36
- name : GoCaptureBetaDeployUser
37
- template : cloud-formation/beta-deploy-user.yaml
38
- parameter-overrides : EcrStackName=${{ steps.ecr-stack-name.outputs.ECR_STACK_NAME }}
39
- capabilities : CAPABILITY_NAMED_IAM
40
- no-fail-on-empty-changeset : 1
41
-
42
- - name : Login to Amazon ECR
43
- id : login-ecr
44
- uses : aws-actions/amazon-ecr-login@v1
45
-
46
- - name : Build, tag, and push docker image to Amazon ECR
47
- env :
48
- BRANCH_NAME : ${{ github.ref_name }}
49
- REGISTRY : ${{ steps.login-ecr.outputs.registry }}
50
- REPOSITORY : go-capture
51
- IMAGE_TAG : ${{ github.sha }}
52
- run : |
53
- docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
54
- if [ $BRANCH_NAME = main ]
55
- then
56
- docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
57
- fi
36
+ context : .
37
+ file : ./Dockerfile
38
+ push : true
39
+ tags : ${{ steps.meta.outputs.tags }}
40
+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments