File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : ECRPush
2+ run-name : Deploy version ${{ inputs.version }} to ${{ inputs.environment }}
3+
4+ on :
5+ workflow_dispatch :
6+ inputs :
7+ version :
8+ type : string
9+ description : " Version of package to deploy"
10+ required : true
11+ environment :
12+ type : environment
13+ description : " Target environment"
14+ required : true
15+
16+ permissions :
17+ id-token : write
18+ contents : read
19+ packages : read
20+
21+ jobs :
22+ pull-push :
23+ runs-on : ubuntu-latest
24+ environment : ${{ inputs.environment }}
25+ concurrency :
26+ group : ${{ github.workflow }}-${{ inputs.version }}-${{ inputs.environment }}-pull-push
27+ cancel-in-progress : true
28+ steps :
29+ - name : Log in to GitHub Container Registry
30+ uses : docker/login-action@b45d80f862d83dbcd57f89517bcf500b2ab88fb2 # v4
31+ with :
32+ registry : ghcr.io
33+ username : ${{ github.actor }}
34+ password : ${{ secrets.GITHUB_TOKEN }}
35+ - name : Configure AWS credentials
36+ uses : aws-actions/configure-aws-credentials@7474bc4690e29a8392af63c5b98e7449536d5c3a # v4
37+ with :
38+ role-to-assume : ${{ vars.AWS_ROLE_ARN }}
39+ role-session-name : gha_build_${{ github.repository_id }}_${{ github.run_id }}
40+ aws-region : ${{ vars.AWS_REGION }}
41+ - name : Login to Amazon ECR
42+ uses : aws-actions/amazon-ecr-login@183a1442edf41672e66566b7fc560e297a290896 # v2
43+ - name : Pull from GHCR, tag for ECR, and push
44+ run : |
45+ SRC="ghcr.io/${{ github.repository }}:${{ inputs.version }}"
46+ DST="${{ vars.MULTI_BUY_SERVICE_ECR_URL }}:${{ inputs.version }}"
47+
48+ echo "Pulling $SRC"
49+ docker pull "$SRC"
50+
51+ echo "Tagging $SRC -> $DST"
52+ docker tag "$SRC" "$DST"
53+
54+ echo "Pushing $DST"
55+ docker push "$DST"
Original file line number Diff line number Diff line change @@ -176,4 +176,4 @@ jobs:
176176 file : Dockerfile
177177 target : runner
178178 push : true
179- tags : ghcr.io/${{ github.repository }}/multi_buy_service :${{ github.ref_name }}
179+ tags : ghcr.io/${{ github.repository }}:${{ github.ref_name }}
You can’t perform that action at this time.
0 commit comments