Merge pull request #365 from Open-Earth-Foundation/dependabot/npm_and… #188
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: Push UI develop to ECR latest | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- ui/** | |
- k8s/openclimate-ui-** | |
branches: [ "develop" ] | |
jobs: | |
runTests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Running tests | |
run: | | |
cd ui | |
npm ci --legacy-peer-deps | |
SKIP_PREFLIGHT_CHECK=true npm run test -- --watchAll=false | |
pushToECR: | |
needs: runTests | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Logging in to ECR | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
run: aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws/openearthfoundation | |
- name: Pushing OC-UI to ECR | |
env: | |
VERSION: ${{ github.sha }} | |
IMAGE: public.ecr.aws/openearthfoundation/openclimate-ui | |
run: | | |
docker build -t $IMAGE:$VERSION ui | |
docker tag $IMAGE:$VERSION $IMAGE:latest | |
docker push $IMAGE:$VERSION | |
docker push $IMAGE:latest | |
deployToEKS: | |
needs: pushToECR | |
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@v3 | |
- 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: Deploying service | |
run: | | |
kubectl apply -f k8s/openclimate-ui-deployment.yml -n default | |
kubectl apply -f k8s/openclimate-ui-service.yml -n default | |
kubectl rollout restart deployment openclimate-ui-deployment -n default |