Skip to content
This repository has been archived by the owner on Feb 11, 2024. It is now read-only.

deploy-infra

deploy-infra #38

Workflow file for this run

name: deploy-infra
on:
workflow_dispatch:
inputs:
environment:
description: 'the environment to deploy to'
required: true
default: 'staging'
type: choice
options:
- prod
- staging
- dev
environment_url:
description: 'the URL of the environment'
required: true
type: string
default: https://history.walletconnect.com/health
workflow_call:
inputs:
environment:
description: 'the environment to deploy to'
required: true
type: string
default: 'staging'
environment_url:
description: 'the URL of the environment'
required: true
type: string
default: https://history.walletconnect.com/health
version:
description: 'the release version'
required: true
type: string
jobs:
deploy-infra:
runs-on: ubuntu-latest
environment:
name: infra/${{ inputs.environment }}
url: ${{ inputs.environment_url }}
env:
TF_VAR_image_version: ${{ inputs.version }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: eu-central-1
- name: Setup Terraform
uses: hashicorp/setup-terraform@v2
with:
cli_config_credentials_token: ${{ secrets.TF_API_TOKEN }}
- name: Get Grafana details
id: grafana-get-details
uses: WalletConnect/actions/aws/grafana/get-details/@1.0.3
- name: Get Grafana key
id: grafana-get-key
uses: WalletConnect/actions/aws/grafana/get-key/@1.0.3
with:
key-prefix: ${{ github.event.repository.name }}
workspace-id: ${{ steps.grafana-get-details.outputs.workspace-id }}
- name: Init Terraform
id: tf-init
uses: WalletConnect/actions/terraform/init/@1.0.3
with:
environment: ${{ inputs.environment }}
- name: Deploy Terraform to ${{ inputs.environment }}
id: tf-apply
uses: WalletConnect/actions/terraform/apply/@1.0.3
env:
GRAFANA_AUTH: ${{ steps.grafana-get-key.outputs.key }}
TF_VAR_grafana_endpoint: ${{ steps.grafana-get-details.outputs.endpoint }}
# TF_VAR_image_version: ${{ needs.get-version.outputs.version }}
with:
environment: ${{ inputs.environment }}
- name: Delete Grafana key
id: grafana-delete-key
uses: WalletConnect/actions/aws/grafana/delete-key/@1.0.3
if: ${{ success() || failure() || cancelled() }} # don't use always() since it creates non-cancellable jobs
with:
key-name: ${{ steps.grafana-get-key.outputs.key-name }}
workspace-id: ${{ steps.grafana-get-details.outputs.workspace-id }}