Merge pull request #893 from fiterafrica/FSMA-159 #93
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to Moni Africa | |
on: | |
push: | |
branches: [ moni ] | |
jobs: | |
deploy: | |
name: Deploy image to ECS | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- uses: kamiazya/setup-graphviz@v1 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_MONI_AFRICA }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_MONI_AFRICA }} | |
aws-region: us-east-2 | |
- id: commit | |
uses: pr-mpt/actions-commit-hash@v1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: fiter-app | |
IMAGE_TAG: ${{ steps.commit.outputs.short }} | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_MONI_AFRICA }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_MONI_AFRICA }} | |
aws-region: us-east-2 | |
- name: installing dependcies | |
run: | | |
curl https://baltocdn.com/helm/signing.asc | gpg --dearmor | sudo tee /usr/share/keyrings/helm.gpg > /dev/null | |
sudo apt-get install apt-transport-https ca-certificates curl --yes | |
sudo curl -fsSLo /usr/share/keyrings/kubernetes-archive-keyring.gpg https://packages.cloud.google.com/apt/doc/apt-key.gpg | |
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/helm.gpg] https://baltocdn.com/helm/stable/debian/ all main" | sudo tee /etc/apt/sources.list.d/helm-stable-debian.list | |
echo "deb [signed-by=/usr/share/keyrings/kubernetes-archive-keyring.gpg] https://apt.kubernetes.io/ kubernetes-xenial main" | sudo tee /etc/apt/sources.list.d/kubernetes.list | |
sudo apt-get update -y | |
sudo apt-get install helm kubectl -y | |
- name: updating kubeconfig and helm repo | |
run: | | |
aws eks --region us-east-2 update-kubeconfig --name moni-africa-dev | |
helm repo add fiter-apps https://chartmuseum.fiter.io/ --username ${{ secrets.CHARTMUSEUM_USERNAME }} --password ${{ secrets.CHARTMUSEUM_PASSWORD }} | |
- name: deploy backend | |
env: | |
IMAGE_TAG: ${{ steps.commit.outputs.short }} | |
FINERACT_CONTENT_S3_BUCKET_NAME: ${{ secrets.FINERACT_CONTENT_S3_BUCKET_NAME }} | |
FINERACT_CONTENT_S3_REGION: ${{ secrets.FINERACT_CONTENT_S3_REGION }} | |
FINERACT_CONTENT_S3_ACCESS_KEY: ${{ secrets.FINERACT_CONTENT_S3_ACCESS_KEY }} | |
FINERACT_CONTENT_S3_SECRET_KEY: ${{ secrets.FINERACT_CONTENT_S3_SECRET_KEY }} | |
run: | | |
cd helm | |
sed -i 's|FINERACT_CONTENT_S3_BUCKET_NAME:.*|FINERACT_CONTENT_S3_BUCKET_NAME: '"$FINERACT_CONTENT_S3_BUCKET_NAME"'|' values.yaml | |
sed -i 's|FINERACT_CONTENT_S3_REGION:.*|FINERACT_CONTENT_S3_REGION: '"$FINERACT_CONTENT_S3_REGION"'|' values.yaml | |
sed -i 's|FINERACT_CONTENT_S3_ACCESS_KEY:.*|FINERACT_CONTENT_S3_ACCESS_KEY: '"$FINERACT_CONTENT_S3_ACCESS_KEY"'|' values.yaml | |
sed -i 's|FINERACT_CONTENT_S3_SECRET_KEY:.*|FINERACT_CONTENT_S3_SECRET_KEY: '"$FINERACT_CONTENT_S3_SECRET_KEY"'|' values.yaml | |
kubectl config set-context --current --namespace=application | |
helm dependency update | |
helm upgrade -i backend --set fineract-rest.tag=$IMAGE_TAG . | |