Enhance API with logging and timeout adjustments; Added detailed logg… #4
This file contains hidden or 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: CAP Plan Creator Deployment | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- '**' # Since your project is not in a backend folder, watch all changes | |
- '.github/workflows/backend.yml' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
REGISTRY: ghcr.io | |
REPOSITORY: open-earth-foundation/cap-plan-creator # Replace with your GitHub username | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v1 | |
- name: Log in to GitHub Container Registry | |
uses: docker/login-action@v1 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get Git commit hash | |
id: vars | |
run: echo "::set-output name=commit_hash::$(git rev-parse --short HEAD)" | |
- name: Build and push image | |
uses: docker/build-push-action@v2 | |
with: | |
context: . # TODO This I'm not sure about | |
push: true | |
tags: | | |
${{ env.REGISTRY }}/${{ env.REPOSITORY }}:${{ steps.vars.outputs.commit_hash }} | |
${{ env.REGISTRY }}/${{ env.REPOSITORY }}:latest | |
deploy: | |
needs: build | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_EKS_DEV_USER }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_EKS_DEV_USER }} | |
EKS_DEV_NAME: ${{ secrets.EKS_DEV_NAME }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Creating kubeconfig file | |
run: aws eks update-kubeconfig --name ${{secrets.EKS_DEV_NAME}} --region us-east-1 | |
- name: Testing connection to EKS | |
run: kubectl get pods -n default | |
- name: Re-deploying service | |
run: | | |
kubectl rollout restart deployment cap-plan-creator -n default |