Skip to content

[pre-commit.ci] pre-commit autoupdate #26

[pre-commit.ci] pre-commit autoupdate

[pre-commit.ci] pre-commit autoupdate #26

Workflow file for this run

name: Automate build and deploy
on:
pull_request:
branches: [ "main" ]
types:
- closed
env:
AWS_REGION: us-west-2
EKS_CLUSTER_NAME: courtlistener
EKS_NAMESPACE: court-listener
jobs:
build:
# Build only merged PRs
if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and Push
run: |
make push --file docker/Makefile -e VERSION=$(git rev-parse --short HEAD)
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set shortcode
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Create Kubeconfig with AWS CLI
run: aws eks update-kubeconfig --region ${{ env.AWS_REGION }} --name ${{ env.EKS_CLUSTER_NAME }}
- name: Rollout cl-doctor
run: kubectl set image -n ${{ env.EKS_NAMESPACE }} deployment/cl-doctor doctor=freelawproject/doctor:${{ steps.vars.outputs.sha_short }}
- name: Watch cl-doctor rollout status
run: kubectl rollout status -n ${{ env.EKS_NAMESPACE }} deployment/cl-doctor