File tree Expand file tree Collapse file tree 3 files changed +59
-3
lines changed Expand file tree Collapse file tree 3 files changed +59
-3
lines changed Original file line number Diff line number Diff line change 1+ name : time-tracker-ui-cd-prod
2+
3+ on :
4+ push :
5+ branches :
6+ - ' fix-workflow'
7+
8+ jobs :
9+ cd :
10+ runs-on : ubuntu-latest
11+ env :
12+ AWS_ACCESS_KEY_ID : ${{secrets.AWS_ACCESS_KEY_ID}}
13+ AWS_SECRET_ACCESS_KEY : ${{secrets.AWS_SECRET_ACCESS_KEY}}
14+
15+ steps :
16+ - name : Checkout
17+ uses : actions/checkout@v3
18+
19+ - name : Get the release_version
20+ run : |
21+ echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
22+ echo $RELEASE_VERSION
23+
24+
25+ - name : Unlock PROD secrets
26+ 27+ env :
28+ GIT_CRYPT_KEY : ${{ secrets.GIT_CRYPT_KEY_PROD }}
29+
30+ - name : Build the docker image
31+ run : |-
32+ docker build \
33+ --target production -t timetracker_ui -f Dockerfile_prod \
34+ .
35+
36+ - name : Publish docker image to prod aws container registry
37+ run : |
38+ make login publish_prod image_tag=$RELEASE_VERSION
39+
40+ # - name: SCP files via ssh key
41+ # uses: appleboy/scp-action@master
42+ # env:
43+ # USERNAME: ${{ secrets.AWS_EC2_USER }}
44+ # HOST: ${{ secrets.PROD_UI_URL }}
45+ # KEY: ${{ secrets.PROD_AWS_PRIVATE_KEY }}
46+ # with:
47+ # source: './infrastructure/aws_ec2.sh'
48+ # target: '.'
49+
50+ # - name: Deploy
51+ # run: |
52+ # TEMP=$(mktemp)
53+ # echo "${{ secrets.PROD_AWS_PRIVATE_KEY }}" > $TEMP
54+ # chmod 400 $TEMP
55+ # ssh -o 'StrictHostKeyChecking no' -i $TEMP ${{ secrets.AWS_EC2_USER }}@${{ secrets.PROD_UI_URL }} "chmod +x ./infrastructure/aws_ec2.sh"
56+ # ssh -o 'StrictHostKeyChecking no' -i $TEMP ${{ secrets.AWS_EC2_USER }}@${{ secrets.PROD_UI_URL }} "./infrastructure/aws_ec2.sh $RELEASE_VERSION" prod
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ name: time-tracker-ui-cd-stage
33on :
44 push :
55 branches :
6- - ' fix-workflow '
6+ - ' fix-workflowfds '
77
88jobs :
99 cd :
3434 --target production -t timetracker_ui -f Dockerfile_stage \
3535 .
3636
37- - name : Publish docker image to stage azure container registry
37+ - name : Publish docker image to stage AWS container registry
3838 run : |
3939 make login publish image_tag=$RELEASE_VERSION
4040
Original file line number Diff line number Diff line change @@ -3,4 +3,4 @@ echo "Deploying $1..."
33docker ps -aq | xargs docker stop| xargs docker rm --force --volumes
44docker system prune -af
55aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 568748651446.dkr.ecr.us-east-1.amazonaws.com
6- docker run -d --name timetracker_api -p 7071:7071 568748651446.dkr.ecr.us-east-1.amazonaws.com/time-tracker/$2 -ui:$1
6+ docker run -d --name timetracker_ui -p 80:80 568748651446.dkr.ecr.us-east-1.amazonaws.com/time-tracker/$2 -ui:$1
You can’t perform that action at this time.
0 commit comments