-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: separate deployment workflow into different files
- Loading branch information
Showing
4 changed files
with
265 additions
and
290 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
name: Production Deployment | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
# Schema Registry CLI command version | ||
CLI_VERSION: v0.0.2 | ||
|
||
jobs: | ||
deploy_to_prod: | ||
name: Deploy production server to google cloud run | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: production | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- id: 'auth' | ||
uses: 'google-github-actions/auth@v0' | ||
with: | ||
credentials_json: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} | ||
project_id: ${{ secrets.GOOGLE_CLOUD_PROJECT }} | ||
|
||
# Configure Docker to use the gcloud command-line tool as a credential | ||
# helper for authentication | ||
- run: |- | ||
gcloud --quiet auth configure-docker | ||
- name: Build and Push Image | ||
run: |- | ||
docker build -t eu.gcr.io/${{ secrets.GOOGLE_CLOUD_PROJECT }}/${{ secrets.GCR_NAME }}:$GITHUB_SHA . | ||
docker push eu.gcr.io/${{ secrets.GOOGLE_CLOUD_PROJECT }}/${{ secrets.GCR_NAME }}:$GITHUB_SHA | ||
- name: Deploy to Google Cloud Run | ||
uses: 'google-github-actions/deploy-cloudrun@v0' | ||
with: | ||
service: ${{ secrets.SERVICE_NAME }} | ||
region: 'europe-west1' | ||
image: 'eu.gcr.io/${{ secrets.GOOGLE_CLOUD_PROJECT }}/${{ secrets.GCR_NAME }}:${{ github.sha }}' | ||
env_vars: | | ||
GOOGLE_CLOUD_PROJECT=${{ secrets.GOOGLE_CLOUD_PROJECT }} | ||
FIREBASE_WEB_API_KEY=${{ secrets.FIREBASE_WEB_API_KEY }} | ||
JWT_KEY=${{ secrets.JWT_KEY }} | ||
GOOGLE_PROJECT_NUMBER=${{ secrets.GOOGLE_PROJECT_NUMBER }} | ||
ENVIRONMENT=${{ secrets.ENVIRONMENT }} | ||
SENTRY_DSN=${{ secrets.SENTRY_DSN }} | ||
ROOT_COLLECTION_SUFFIX=${{ secrets.ROOT_COLLECTION_SUFFIX }} | ||
CLOUD_HEALTH_PUBSUB_TOPIC=${{ secrets.CLOUD_HEALTH_PUBSUB_TOPIC }} | ||
CLOUD_HEALTH_DATASET_ID=${{ secrets.CLOUD_HEALTH_DATASET_ID }} | ||
CLOUD_HEALTH_FHIRSTORE_ID=${{ secrets.CLOUD_HEALTH_FHIRSTORE_ID }} | ||
OPENCONCEPTLAB_TOKEN=${{ secrets.OPENCONCEPTLAB_TOKEN }} | ||
SERVICE_HOST=${{ secrets.SERVICE_HOST }} | ||
OPENCONCEPTLAB_API_URL=${{ secrets.OPENCONCEPTLAB_API_URL }} | ||
SAVANNAH_ADMIN_EMAIL=${{ secrets.SAVANNAH_ADMIN_EMAIL }} | ||
push_schema_prod_registry: | ||
name: Publish schema to prod schema registry | ||
strategy: | ||
matrix: | ||
go-version: [1.18.x] | ||
runs-on: ubuntu-latest | ||
needs: [deploy_to_prod] | ||
environment: | ||
name: production | ||
env: | ||
REGISTRY_URL: ${{ secrets.PROD_SCHEMA_REGISTRY_URL }} | ||
steps: | ||
- name: Checkout working branches | ||
uses: actions/checkout@v2 | ||
|
||
# Install Go | ||
- name: Install Go | ||
uses: actions/setup-go@v2 | ||
with: | ||
go-version: ${{ matrix.go-version }} | ||
|
||
# install CLI command and push schema to registry | ||
# just to be sure, we re-validate the schema against schema registry | ||
- name: Install CLI command and push schema to registry | ||
run: | | ||
go install github.com/savannahghi/bewellcli@$CLI_VERSION | ||
bewellcli service validate-schema --name clinical --version $GITHUB_SHA --url ${{ secrets.GRAPHQL_URL }} | ||
bewellcli service push-schema --name clinical --version $GITHUB_SHA --url ${{ secrets.GRAPHQL_URL }} |
Oops, something went wrong.