Skip to content

Commit

Permalink
Revert "Fix workflow config (#20)"
Browse files Browse the repository at this point in the history
This reverts commit 10f2bcd.
  • Loading branch information
NYARAS committed Aug 26, 2021
1 parent 10f2bcd commit 65c33db
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 94 deletions.
97 changes: 5 additions & 92 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Deployment

on: [push]
on:
push:
branches: [develop]

env:
DOCKER_BUILDKIT: 1 # Enable Buildkit and let compose use it to speed up image building
Expand All @@ -16,9 +18,7 @@ jobs:
build_and_push_image:
runs-on: ubuntu-latest
environment:
name: test, staging, production # run only in these three environment
# TODO: add develop
if: github.ref == 'refs/heads/opensource' || github.ref == 'refs/heads/main'
name: test # run this only in test environment for now
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -47,8 +47,6 @@ jobs:
runs-on: ubuntu-latest
environment:
name: test
# TODO: add develop
if: github.ref == 'refs/heads/opensource'
needs: [build_and_push_image]
steps:
- name: Checkout working branches
Expand Down Expand Up @@ -84,92 +82,8 @@ jobs:
--set-env-vars "CLOUD_HEALTH_FHIRSTORE_ID=${{ secrets.CLOUD_HEALTH_FHIRSTORE_ID }}" \
--set-env-vars "OPENCONCEPTLAB_TOKEN=${{ secrets.OPENCONCEPTLAB_TOKEN }}" \
--set-env-vars "OPENCONCEPTLAB_API_URL=${{ secrets.OPENCONCEPTLAB_API_URL }}"
deploy_to_prod:
name: Deploy Prod Server to Google Cloud Run
runs-on: ubuntu-latest
environment:
name: production
needs: [build_and_push_image]
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout working branches
uses: actions/checkout@v2

# Deploy to Google Cloud Run Serverless
- name: Get GCP project credential
uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
export_default_credentials: true

# Deploy to Google Cloud Run Serverless
- name: Deploy to Google Cloud Run
run: |
gcloud run deploy ${{ secrets.SERVICE_NAME }} --image eu.gcr.io/${{ secrets.GOOGLE_CLOUD_PROJECT }}/${{ secrets.GCR_NAME }}:$GITHUB_SHA \
--region europe-west1 \
--platform managed \
--allow-unauthenticated \
--min-instances=${{ secrets.MIN_INST }} \
--max-instances=${{ secrets.MAX_INST }} \
--memory=${{ secrets.MEMORY_LIMIT}} \
--cpu=${{ secrets.CPU }} \
--set-env-vars "GOOGLE_CLOUD_PROJECT=${{ secrets.GOOGLE_CLOUD_PROJECT }}" \
--set-env-vars "FIREBASE_WEB_API_KEY=${{ secrets.FIREBASE_WEB_API_KEY }}" \
--set-env-vars "JWT_KEY=${{ secrets.JWT_KEY }}" \
--set-env-vars "ENVIRONMENT=${{ secrets.ENVIRONMENT }}" \
--set-env-vars "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" \
--set-env-vars "ROOT_COLLECTION_SUFFIX=${{ secrets.ROOT_COLLECTION_SUFFIX }}" \
--set-env-vars "CLOUD_HEALTH_PUBSUB_TOPIC=${{ secrets.CLOUD_HEALTH_PUBSUB_TOPIC }}" \
--set-env-vars "CLOUD_HEALTH_DATASET_ID=${{ secrets.CLOUD_HEALTH_DATASET_ID }}" \
--set-env-vars "CLOUD_HEALTH_FHIRSTORE_ID=${{ secrets.CLOUD_HEALTH_FHIRSTORE_ID }}" \
--set-env-vars "OPENCONCEPTLAB_TOKEN=${{ secrets.OPENCONCEPTLAB_TOKEN }}" \
--set-env-vars "OPENCONCEPTLAB_API_URL=${{ secrets.OPENCONCEPTLAB_API_URL }}"
deploy_to_staging:
name: Deploy Staging Server to Google Cloud Run
runs-on: ubuntu-latest
environment:
name: staging
needs: [build_and_push_image]
if: github.ref == 'refs/heads/opensource'
steps:
- name: Checkout working branches
uses: actions/checkout@v2

# Deploy to Google Cloud Run Serverless
- name: Get GCP project credential
uses: google-github-actions/setup-gcloud@master
with:
service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }}
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT }}
export_default_credentials: true
# Deploy to Google Cloud Run Serverless
- name: Deploy to Google Cloud Run
run: |
gcloud run deploy ${{ secrets.SERVICE_NAME }} --image eu.gcr.io/${{ secrets.GOOGLE_CLOUD_PROJECT }}/${{ secrets.GCR_NAME }}:$GITHUB_SHA \
--region europe-west1 \
--platform managed \
--allow-unauthenticated \
--min-instances=${{ secrets.MIN_INST }} \
--max-instances=${{ secrets.MAX_INST }} \
--memory=${{ secrets.MEMORY_LIMIT}} \
--cpu=${{ secrets.CPU }} \
--set-env-vars "GOOGLE_CLOUD_PROJECT=${{ secrets.GOOGLE_CLOUD_PROJECT }}" \
--set-env-vars "FIREBASE_WEB_API_KEY=${{ secrets.FIREBASE_WEB_API_KEY }}" \
--set-env-vars "JWT_KEY=${{ secrets.JWT_KEY }}" \
--set-env-vars "ENVIRONMENT=${{ secrets.ENVIRONMENT }}" \
--set-env-vars "SENTRY_DSN=${{ secrets.SENTRY_DSN }}" \
--set-env-vars "ROOT_COLLECTION_SUFFIX=${{ secrets.ROOT_COLLECTION_SUFFIX }}" \
--set-env-vars "CLOUD_HEALTH_PUBSUB_TOPIC=${{ secrets.CLOUD_HEALTH_PUBSUB_TOPIC }}" \
--set-env-vars "CLOUD_HEALTH_DATASET_ID=${{ secrets.CLOUD_HEALTH_DATASET_ID }}" \
--set-env-vars "CLOUD_HEALTH_FHIRSTORE_ID=${{ secrets.CLOUD_HEALTH_FHIRSTORE_ID }}" \
--set-env-vars "OPENCONCEPTLAB_TOKEN=${{ secrets.OPENCONCEPTLAB_TOKEN }}" \
--set-env-vars "OPENCONCEPTLAB_API_URL=${{ secrets.OPENCONCEPTLAB_API_URL }}"
push_schema_test_registry:
push_schema:
name: Publish schema to schema registry
strategy:
matrix:
Expand All @@ -193,4 +107,3 @@ jobs:
go install github.com/savannahghi/bewellcli@$CLI_VERSION
bewellcli service validate-schema --name clinical --version $GITHUB_SHA --url ${{ secrets.SERVICE_GRAPHQL_URL }}
bewellcli service push-schema --name clinical --version $GITHUB_SHA --url ${{ secrets.SERVICE_GRAPHQL_URL }}
9 changes: 7 additions & 2 deletions deps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ staging:
depRootDomain: https://engagement-staging.healthcloud.co.ke
testing:
- depName: onboarding
depRootDomain: https://onboarding-testing.savannahghi.org
depRootDomain: https://profile-testing.healthcloud.co.ke
- depName: engagement
depRootDomain: https://engagement-testing.savannahghi.org
depRootDomain: https://engagement-testing.healthcloud.co.ke
demo:
- depName: onboarding
depRootDomain: https://profile-demo.healthcloud.co.ke
- depName: engagement
depRootDomain: https://engagement-demo.healthcloud.co.ke
production:
- depName: onboarding
depRootDomain: https://profile-prod.healthcloud.co.ke
Expand Down

0 comments on commit 65c33db

Please sign in to comment.