Skip to content

Commit

Permalink
Merge pull request #38 from MinaFoundation/PM-1524-deploy-workflow
Browse files Browse the repository at this point in the history
PM-1524 Autodeploy workflow
  • Loading branch information
Smorci authored May 1, 2024
2 parents 64bfbb3 + 4250778 commit 4a6bee4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and publish
name: Build - publish - deploy

on:
push:
Expand All @@ -14,14 +14,23 @@ on:
env:
ECR_REPOSITORY_URL: 673156464838.dkr.ecr.us-west-2.amazonaws.com
ECR_REPOSITORY_NAME: gpt-survey-summarizer
APPLICATION_NAME: gpt-survey-summarizer
DOCKER_TAG_PREFIX: ${{ github.event.inputs.docker_tag_prefix }}
PLATFORM: staging
NAMESPACE: governance

jobs:
build-and-publish:
name: Build and Publish Docker Image
build-publish-deploy:
name: Build Publish and Deploy Docker Image
runs-on: minafoundation-default-runners
steps:

- name: ⚙️ Set environment variables
run: |
echo "AWS_REGION=$AWS_REGION" >> $GITHUB_ENV
echo "DEPLOYMENT_ROLE_NAME=$DEPLOYMENT_ROLE_NAME" >> $GITHUB_ENV
echo "AWS_ROLE_DURATION_SECONDS=$AWS_ROLE_DURATION_SECONDS" >> $GITHUB_ENV
- name: 📥 Checkout
uses: actions/checkout@v4

Expand Down Expand Up @@ -60,3 +69,21 @@ jobs:
image: ${{ env.ECR_REPOSITORY_NAME }}
registry: ${{ env.ECR_REPOSITORY_URL }}
tags: ${{ env.TAG }}

- name: 🔑 Assume role
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ env.AWS_REGION }}
role-to-assume: ${{ env.DEPLOYMENT_ROLE_NAME }}
role-session-name: ${{ env.DEPLOYMENT_ROLE_NAME }}
role-duration-seconds: ${{ env.AWS_ROLE_DURATION_SECONDS }}

- name: ⬇️ Get kubeconfig
run: aws eks update-kubeconfig --name $PLATFORM --region $AWS_REGION 1>/dev/null

# "*=" means we set the image for every container in the selected deployments
- name: 💿 Set deployment image
run: kubectl set image deployment "*=$ECR_REPOSITORY_URL/$ECR_REPOSITORY_NAME:$TAG" -l app.kubernetes.io/name=$APPLICATION_NAME -n $NAMESPACE

- name: ⏱️ Wait for deployment to be ready
run: kubectl rollout status deployment --timeout=10m -l app.kubernetes.io/name=$APPLICATION_NAME -n $NAMESPACE
1 change: 1 addition & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@

/Dockerfile @MinaFoundation/infra-eng-reviewers
/docker-compose.yaml @MinaFoundation/infra-eng-reviewers
/.github/workflows @MinaFoundation/infra-eng-reviewers

0 comments on commit 4a6bee4

Please sign in to comment.