Skip to content

Deploy to all test envs #105

Deploy to all test envs

Deploy to all test envs #105

name: Deploy to all test envs
on:
workflow_dispatch:
jobs:
run_tests:
uses: ./.github/workflows/test.yml
secrets: inherit
generate_image_tags:
uses: ./.github/workflows/generate_image_tags.yml
secrets: inherit
build_images:
uses: ./.github/workflows/build.yml
secrets: inherit
deploy:
needs:
- run_tests
- build_images
- generate_image_tags
runs-on: ubuntu-20.04
env:
API_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.API_IMAGE_TAG }}
AM_CLEANUP_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.AM_CLEANUP_IMAGE_TAG }}
RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG }}
THUMBNAIL_REFRESH_IMAGE_TAG: ${{ needs.generate_image_tags.outputs.THUMBNAIL_REFRESH_IMAGE_TAG }}
defaults:
run:
working-directory: ./terraform/test_cluster
steps:
- uses: actions/checkout@v3
- name: Setup Terraform
uses: hashicorp/setup-terraform@v1
with:
cli_config_credentials_token: ${{ secrets.TERRAFORM_API_TOKEN }}
- name: Terraform Init
id: init
run: terraform init
- name: Terraform Validate
id: validate
run: terraform validate -no-color
- name: Terraform Plan
id: plan
run: |
terraform plan -no-color -input=false \
-var="stela_dev_image=$API_IMAGE_TAG" \
-var="stela_staging_image=$API_IMAGE_TAG" \
-var="archivematica_cleanup_dev_image=$AM_CLEANUP_IMAGE_TAG" \
-var="archivematica_cleanup_staging_image=$AM_CLEANUP_IMAGE_TAG" \
-var="record_thumbnail_dev_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \
-var="record_thumbnail_staging_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \
-var="thumbnail_refresh_dev_image=$THUMBNAIL_REFRESH_IMAGE_TAG" \
-var="thumbnail_refresh_staging_image=$THUMBNAIL_REFRESH_IMAGE_TAG"
- name: Terraform Apply
run: |
terraform apply -auto-approve -input=false \
-var="stela_dev_image=$API_IMAGE_TAG" \
-var="stela_staging_image=$API_IMAGE_TAG" \
-var="archivematica_cleanup_dev_image=$AM_CLEANUP_IMAGE_TAG" \
-var="archivematica_cleanup_staging_image=$AM_CLEANUP_IMAGE_TAG" \
-var="record_thumbnail_dev_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \
-var="record_thumbnail_staging_lambda_image=$RECORD_THUMBNAIL_LAMBDA_IMAGE_TAG" \
-var="thumbnail_refresh_dev_image=$THUMBNAIL_REFRESH_IMAGE_TAG" \
-var="thumbnail_refresh_staging_image=$THUMBNAIL_REFRESH_IMAGE_TAG"