Skip to content

Commit 6d31865

Browse files
committed
test prod pipeline
1 parent 6a56248 commit 6d31865

File tree

3 files changed

+59
-3
lines changed

3 files changed

+59
-3
lines changed

.github/workflows/aws-ui-cd-prod.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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+
uses: sliteteam/[email protected]
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

.github/workflows/aws-ui-cd-stage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: time-tracker-ui-cd-stage
33
on:
44
push:
55
branches:
6-
- 'fix-workflow'
6+
- 'fix-workflowfds'
77

88
jobs:
99
cd:
@@ -34,7 +34,7 @@ jobs:
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

infrastructure/aws_ec2.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ echo "Deploying $1..."
33
docker ps -aq | xargs docker stop| xargs docker rm --force --volumes
44
docker system prune -af
55
aws 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

0 commit comments

Comments
 (0)