Skip to content

Fix syntax

Fix syntax #18

Workflow file for this run

name: 'Deploy ingestor'
on:
push:
pull_request:
jobs:
deploy_ingestor:
name: 'Deploy ingestor'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./ingestor
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Configure Docker
if: github.ref == 'refs/heads/main' # Only run on main branch
run: echo $GOOGLE_CREDENTIALS | gcloud auth activate-service-account --key-file=- && gcloud auth configure-docker
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Build and push Docker image
uses: docker/build-push-action@v2
if: github.ref == 'refs/heads/main' # Only run on main branch
with:
context: ./ingestor
file: ./ingestor/Dockerfile
push: true
tags: gcr.io/${{ secrets.GCP_PROJECT_ID }}/ingestor:latest
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.5.4
- name: Setup Google Credentials
run: echo '${{ secrets.GOOGLE_CREDENTIALS }}' > ./google_credentials.json
env:
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Terraform Init
run: terraform init -lock=false
env:
TF_VAR_gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
TF_VAR_gcp_region: ${{ secrets.GCP_REGION }}
TF_VAR_credentials_path: ./google_credentials.json
- name: Terraform Validate
run: terraform validate
- name: Terraform Plan
run: terraform plan -lock=false
if: github.ref == 'refs/heads/main' # Only run on main branch
env:
TF_VAR_gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
TF_VAR_gcp_region: ${{ secrets.GCP_REGION }}
TF_VAR_mongo_connection_string: ${{ secrets.MONGO_CONNECTION_STRING }}
TF_VAR_credentials_path: ./google_credentials.json
TF_VAR_google_credentials: ${{ secrets.GOOGLE_CREDENTIALS }}
TF_VAR_bucket_api_raw: ${{ secrets.BUCKET_API_RAW }}
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}
- name: Terraform Apply
run: terraform apply -auto-approve -lock=false
if: github.ref == 'refs/heads/main' # Only run on main branch
env:
TF_VAR_gcp_project_id: ${{ secrets.GCP_PROJECT_ID }}
TF_VAR_gcp_region: ${{ secrets.GCP_REGION }}
TF_VAR_mongo_connection_string: ${{ secrets.MONGO_CONNECTION_STRING }}
TF_VAR_credentials_path: ./google_credentials.json
TF_VAR_google_credentials: ${{ secrets.GOOGLE_CREDENTIALS }}
TF_VAR_bucket_api_raw: ${{ secrets.BUCKET_API_RAW }}
GOOGLE_CREDENTIALS: ${{ secrets.GOOGLE_CREDENTIALS }}