Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test prod pipeline
  • Loading branch information
mmaquina committed Mar 16, 2023
commit 6d3186589045aa5033d84ca42c1d05d49bb946db
56 changes: 56 additions & 0 deletions .github/workflows/aws-ui-cd-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: time-tracker-ui-cd-prod

on:
push:
branches:
- 'fix-workflow'

jobs:
cd:
runs-on: ubuntu-latest
env:
AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Get the release_version
run: |
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo $RELEASE_VERSION


- name: Unlock PROD secrets
uses: sliteteam/[email protected]
env:
GIT_CRYPT_KEY: ${{ secrets.GIT_CRYPT_KEY_PROD }}

- name: Build the docker image
run: |-
docker build \
--target production -t timetracker_ui -f Dockerfile_prod \
.

- name: Publish docker image to prod aws container registry
run: |
make login publish_prod image_tag=$RELEASE_VERSION

# - name: SCP files via ssh key
# uses: appleboy/scp-action@master
# env:
# USERNAME: ${{ secrets.AWS_EC2_USER }}
# HOST: ${{ secrets.PROD_UI_URL }}
# KEY: ${{ secrets.PROD_AWS_PRIVATE_KEY }}
# with:
# source: './infrastructure/aws_ec2.sh'
# target: '.'

# - name: Deploy
# run: |
# TEMP=$(mktemp)
# echo "${{ secrets.PROD_AWS_PRIVATE_KEY }}" > $TEMP
# chmod 400 $TEMP
# ssh -o 'StrictHostKeyChecking no' -i $TEMP ${{ secrets.AWS_EC2_USER }}@${{ secrets.PROD_UI_URL }} "chmod +x ./infrastructure/aws_ec2.sh"
# ssh -o 'StrictHostKeyChecking no' -i $TEMP ${{ secrets.AWS_EC2_USER }}@${{ secrets.PROD_UI_URL }} "./infrastructure/aws_ec2.sh $RELEASE_VERSION" prod
4 changes: 2 additions & 2 deletions .github/workflows/aws-ui-cd-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: time-tracker-ui-cd-stage
on:
push:
branches:
- 'fix-workflow'
- 'fix-workflowfds'

jobs:
cd:
Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
--target production -t timetracker_ui -f Dockerfile_stage \
.

- name: Publish docker image to stage azure container registry
- name: Publish docker image to stage AWS container registry
run: |
make login publish image_tag=$RELEASE_VERSION

Expand Down
2 changes: 1 addition & 1 deletion infrastructure/aws_ec2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ echo "Deploying $1..."
docker ps -aq | xargs docker stop| xargs docker rm --force --volumes
docker system prune -af
aws ecr get-login-password --region us-east-1 | docker login --username AWS --password-stdin 568748651446.dkr.ecr.us-east-1.amazonaws.com
docker run -d --name timetracker_api -p 7071:7071 568748651446.dkr.ecr.us-east-1.amazonaws.com/time-tracker/$2-ui:$1
docker run -d --name timetracker_ui -p 80:80 568748651446.dkr.ecr.us-east-1.amazonaws.com/time-tracker/$2-ui:$1