chore(version): v0.34.0 #37
Workflow file for this run
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 tagged Global API to GHCR and deploy to production | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- global-api/** | |
- k8s/cc-global-api-deploy.yml | |
- k8s/cc-global-api.yml | |
- k8s/cc-global-api-migrate.yml | |
- .github/workflows/global-api-tag.yml | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+' | |
jobs: | |
pushToGHCR: | |
runs-on: ubuntu-latest | |
if: ${{ !contains(github.ref, '-') }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Log in to the Container registry | |
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Pushing citycatalyst to GHCR | |
env: | |
SHA: ${{ github.sha }} | |
REF: ${{ github.ref }} | |
IMAGE: ghcr.io/open-earth-foundation/citycatalyst-global-api | |
run: | | |
export VERSION=${REF#refs/tags/v} | |
export MAJOR=${VERSION%.*.*} | |
export MINOR=${VERSION%.*} | |
echo Version: ${VERSION} Major: ${MAJOR} Minor: ${MINOR} | |
docker build -t $IMAGE:$SHA global-api | |
docker tag $IMAGE:$SHA $IMAGE:$VERSION | |
docker tag $IMAGE:$SHA $IMAGE:$MAJOR | |
docker tag $IMAGE:$SHA $IMAGE:$MINOR | |
docker tag $IMAGE:$SHA $IMAGE:stable | |
docker push $IMAGE:$SHA | |
docker push $IMAGE:$VERSION | |
docker push $IMAGE:$MAJOR | |
docker push $IMAGE:$MINOR | |
docker push $IMAGE:stable | |
deployToEKS: | |
needs: pushToGHCR | |
if: ${{ !contains(github.ref, '-') }} | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_EKS_PROD_USER }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_EKS_PROD_USER }} | |
EKS_DEV_NAME: ${{ secrets.EKS_PROD_NAME }} | |
REF: ${{ github.ref }} | |
IMAGE: ghcr.io/open-earth-foundation/citycatalyst-global-api | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Creating kubeconfig file | |
run: aws eks update-kubeconfig --name ${{ secrets.EKS_PROD_NAME }} --region us-east-1 | |
- name: Testing connection to EKS | |
run: kubectl get pods -n default | |
- name: Deploying service | |
run: | | |
export VERSION=${REF#refs/tags/v} | |
export VERSION=${REF#refs/tags/v} | |
kubectl create -f k8s/cc-global-api-migrate.yml -n default | |
kubectl apply -f k8s/cc-global-api-deploy.yml -n default | |
kubectl set image deployment/cc-global-api-deploy \ | |
cc-global-api=$IMAGE:$VERSION \ | |
-n default | |
kubectl rollout restart deployment cc-global-api-deploy -n default |