Continous update cloud_run #465
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: "Continous update cloud_run" | |
on: | |
workflow_run: | |
workflows: [Build and Publish "slackbot" docker image, Terraform Deployment] | |
types: | |
- completed | |
workflow_dispatch: | |
branches: ["master"] | |
permissions: | |
contents: read | |
jobs: | |
terraform: | |
name: "Replace cloud_run images " | |
runs-on: ubuntu-latest | |
environment: production | |
# Use the Bash shell regardless whether the GitHub Actions runner is ubuntu-latest, macos-latest, or windows-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
# Checkout the repository to the GitHub Actions runner | |
- name: Checkout | |
uses: actions/checkout@v3 | |
# Install the latest version of Terraform CLI and configure the Terraform CLI configuration file with a Terraform Cloud user API token | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v2 | |
with: | |
cli_config_credentials_token: ${{ secrets.GCP_CREDENTIALS }} | |
# Initialize a new or existing Terraform working directory by creating initial files, loading any remote state, downloading modules, etc. | |
- name: Init | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
run: terraform init | |
# Generates an execution plan for Terraform | |
#- name: Terraform Plan | |
# env: | |
# GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
# run: terraform plan -input=false | |
# On push to "master", build or change infrastructure according to Terraform configuration files | |
# Note: It is recommended to set up a required "strict" status check in your repository for "Terraform Cloud". See the documentation on "strict" required status checks for more information: https://help.github.com/en/github/administering-a-repository/types-of-required-status-checks | |
- name: Apply | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
run: terraform apply -input=false -var="token_bypass=${{ secrets.TOKEN_BYPASS }}" -var="slack_signing_secret=${{ secrets.SLACK_SIGNING_SECRET }}" -var="slack_bot_token=${{ secrets.SLACK_BOT_TOKEN}}" -auto-approve -input=false | |
- name: Replace | |
env: | |
GOOGLE_CREDENTIALS: ${{ secrets.GCP_CREDENTIALS }} | |
run: terraform apply -input=false -var="token_bypass=${{ secrets.TOKEN_BYPASS }}" -var="slack_signing_secret=${{ secrets.SLACK_SIGNING_SECRET }}" -var="slack_bot_token=${{ secrets.SLACK_BOT_TOKEN}}" -replace=google_cloud_run_service.react -replace=google_cloud_run_service.slackbot -auto-approve -input=false |