Deploy CEP #140
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: Deploy CEP | |
on: | |
push: | |
branches: | |
- dev | |
- master | |
jobs: | |
setup-build-publish-deploy: | |
name: Setup, Build, Publish and Deploy | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- uses: google-github-actions/setup-gcloud@v0 | |
with: | |
service_account_email: ${{ secrets.GCP_EMAIL }} | |
service_account_key: ${{ secrets.GCP_CREDENTIALS }} | |
- name: Configure Docker | |
run: | | |
gcloud auth configure-docker | |
- name: Build & Publish - staging | |
if: github.ref == 'refs/heads/dev' | |
run: | | |
gcloud config set project ${{ secrets.GCP_PROJECT }} | |
gcloud builds submit --tag gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GCP_APPLICATION }}:staging-${{ github.sha }} | |
gcloud config set run/region us-central1 | |
gcloud container clusters get-credentials sjcc-staging --zone us-central1 --project ${{ secrets.GCP_PROJECT }} | |
- name: Build & Publish - production | |
if: github.ref == 'refs/heads/master' | |
run: | | |
gcloud config set project ${{ secrets.GCP_PROJECT }} | |
gcloud builds submit --tag gcr.io/${{ secrets.GCP_PROJECT }}/${{ secrets.GCP_APPLICATION }}:production-${{ github.sha }} | |
gcloud config set run/region us-central1 | |
gcloud container clusters get-credentials sjcc-production --zone us-central1 --project ${{ secrets.GCP_PROJECT }} | |
- uses: azure/setup-helm@v1 | |
id: install | |
- name: Install or Upgrade - staging | |
if: github.ref == 'refs/heads/dev' | |
run: helm upgrade --install ${{ secrets.GCP_APPLICATION }} Chart/ --set app.version=${{ github.sha }} --set app.enviroment=staging --set app.host=dev.cep.ojnn.com.br --set app.rCpu=0.1 --set app.rMemory=64Mi --set app.lCpu=0.15 --set app.lMemory=128Mi --set app.minReplicas=1 --set app.maxReplicas=1 --namespace cep --create-namespace | |
- name: Install or Upgrade - production | |
if: github.ref == 'refs/heads/master' | |
run: helm upgrade --install ${{ secrets.GCP_APPLICATION }} Chart/ --set app.version=${{ github.sha }} --set app.enviroment=production --set app.host=cep.ojnn.com.br --set app.rCpu=0.5 --set app.rMemory=512Mi --set app.lCpu=1 --set app.lMemory=1024Mi --set app.minReplicas=2 --set app.maxReplicas=10 --namespace cep --create-namespace |