Skip to content

Commit

Permalink
ci: Add Inferable cloud deployment step
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Nov 28, 2024
1 parent 3d9dc54 commit e605158
Showing 1 changed file with 56 additions and 2 deletions.
58 changes: 56 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
cli: ${{ steps.filter.outputs.cli }}
control_plane: ${{ steps.filter.outputs.control_plane }}
app: ${{ steps.filter.outputs.app }}
# Deploy steps (Docker build / CFN) if either control-plane or app changed
deploy: ${{ steps.filter.outputs.deploy }}
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -50,6 +52,9 @@ jobs:
- 'control-plane/**'
app:
- 'app/**'
deploy:
- 'control-plane/**'
- 'app/**'
build-control-plane:
needs: check_changes
Expand Down Expand Up @@ -404,7 +409,8 @@ jobs:

build-app-image:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs: check_changes
if: ${{ needs.check_changes.outputs.deploy == 'true' && github.ref == 'refs/heads/main' }}
permissions:
id-token: write
steps:
Expand Down Expand Up @@ -449,7 +455,8 @@ jobs:
build-control-plane-image:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs: check_changes
if: ${{ needs.check_changes.outputs.deploy == 'true' && github.ref == 'refs/heads/main' }}
permissions:
id-token: write
steps:
Expand Down Expand Up @@ -495,3 +502,50 @@ jobs:
docker tag $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG $DOCKERHUB_USERNAME/control-plane:latest
docker push $DOCKERHUB_USERNAME/control-plane:$IMAGE_TAG
docker push $DOCKERHUB_USERNAME/control-plane:latest
deploy-cloud:
runs-on: ubuntu-latest
if: ${{ github.ref == 'refs/heads/main' }}
needs:
[check_changes, build-app-image, build-control-plane-image]
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Notify start deploy to Rollbar
uses: rollbar/[email protected]
id: rollbar_pre_deploy
with:
environment: 'production'
version: ${{ github.sha }}
status: 'started'
env:
ROLLBAR_ACCESS_TOKEN: ${{ secrets.CLOUD_ROLLBAR_ACCESS_TOKEN }}
ROLLBAR_USERNAME: ${{ github.actor }}
- name: Deploy to AWS CloudFormation
uses: aws-actions/aws-cloudformation-github-deploy@v1
with:
name: "prod-inferable"
role-arn: ${{ secrets.CLOUD_AWS_CFN_ROLE_ARN }}
template: ${{ secrets.CLOUD_AWS_CFN_TEMPLATE }}
tags: "Environment=prod"
capabilities: "CAPABILITY_NAMED_IAM,CAPABILITY_IAM"
parameter-overrides: >-
Environment=prod,
ApiImageTag=${{ github.sha }},
AppImageTag=${{ github.sha }}
- name: Notify finish deploy to Rollbar
uses: rollbar/[email protected]
id: rollbar_post_deploy
with:
environment: 'production'
version: ${{ github.sha }}
status: 'succeeded'
env:
ROLLBAR_ACCESS_TOKEN: ${{ secrets.CLOUD_ROLLBAR_ACCESS_TOKEN }}
ROLLBAR_USERNAME: ${{ github.actor }}
DEPLOY_ID: ${{ steps.rollbar_pre_deploy.outputs.deploy_id }}

0 comments on commit e605158

Please sign in to comment.