Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add workflow files for existing envs #46

Merged
merged 3 commits into from
Jun 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
204 changes: 204 additions & 0 deletions .github/workflows/bench.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
---
name: bench
on:
push:
branches:
- main
paths:
- 'terraform/environments/bench/**'
- '.github/workflows/bench.yml'
pull_request:
branches:
- main
types: [opened, edited, reopened, synchronize]
paths:
- 'terraform/environments/bench/**'
- '.github/workflows/bench.yml'
workflow_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
TF_IN_AUTOMATION: true
defaults:
run:
shell: bash

jobs:

# These jobs run when creating a pull request
plan-development:
name: Plan Development - bench
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Load and Configure Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 0.14.6
terraform_wrapper: false
- name: Terraform plan - development
run: |
echo "Terraform plan - ${TF_ENV}"
bash scripts/terraform-init.sh terraform/environments/bench
terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
bash scripts/terraform-plan.sh terraform/environments/bench
env:
TF_ENV: development

deploy-development:
name: Deploy Development - bench
runs-on: ubuntu-latest
if: github.ref != 'refs/heads/main'
environment:
name: bench-development
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Load and Configure Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 0.14.6
terraform_wrapper: false
- name: Terraform apply - development
run: |
echo "Terraform apply - ${TF_ENV}"
bash scripts/terraform-init.sh terraform/environments/bench
terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
bash scripts/terraform-apply.sh terraform/environments/bench
env:
TF_ENV: development

# plan-test:
# name: Plan Test - bench
# runs-on: ubuntu-latest
# if: github.ref != 'refs/heads/main'
# steps:
# - name: Checkout Repository
# uses: actions/[email protected]
# - name: Load and Configure Terraform
# uses: hashicorp/[email protected]
# with:
# terraform_version: 0.14.6
# terraform_wrapper: false
# - name: Terraform plan - test
# run: |
# echo "Terraform plan - ${TF_ENV}"
# bash scripts/terraform-init.sh terraform/environments/bench
# terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
# bash scripts/terraform-plan.sh terraform/environments/bench
# env:
# TF_ENV: test

# deploy-test:
# name: Deploy Test - bench
# runs-on: ubuntu-latest
# if: github.ref != 'refs/heads/main'
# environment:
# name: bench-test
# steps:
# - name: Checkout Repository
# uses: actions/[email protected]
# - name: Load and Configure Terraform
# uses: hashicorp/[email protected]
# with:
# terraform_version: 0.14.6
# terraform_wrapper: false
# - name: Terraform apply - test
# run: |
# echo "Terraform apply - ${TF_ENV}"
# bash scripts/terraform-init.sh terraform/environments/bench
# terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
# bash scripts/terraform-apply.sh terraform/environments/bench
# env:
# TF_ENV: test

# # These jobs run after merging to main
# plan-preproduction:
# name: Plan Preproduction - bench
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
# steps:
# - name: Checkout Repository
# uses: actions/[email protected]
# - name: Load and Configure Terraform
# uses: hashicorp/[email protected]
# with:
# terraform_version: 0.14.6
# terraform_wrapper: false
# - name: Terraform plan - preproduction
# run: |
# echo "Terraform plan - ${TF_ENV}"
# bash scripts/terraform-init.sh terraform/environments/bench
# terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
# bash scripts/terraform-plan.sh terraform/environments/bench
# env:
# TF_ENV: preproduction

# deploy-preproduction:
# name: Deploy Preproduction - bench
# runs-on: ubuntu-latest
# if: github.ref == 'refs/heads/main'
# environment:
# name: bench-preproduction
# steps:
# - name: Checkout Repository
# uses: actions/[email protected]
# - name: Load and Configure Terraform
# uses: hashicorp/[email protected]
# with:
# terraform_version: 0.14.6
# terraform_wrapper: false
# - name: Terraform apply - preproduction
# run: |
# echo "Terraform apply - ${TF_ENV}"
# bash scripts/terraform-init.sh terraform/environments/bench
# terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
# bash scripts/terraform-apply.sh terraform/environments/bench
# env:
# TF_ENV: preproduction

plan-production:
name: Plan Production - bench
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Load and Configure Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 0.14.6
terraform_wrapper: false
- name: Terraform plan - production
run: |
echo "Terraform plan - ${TF_ENV}"
bash scripts/terraform-init.sh terraform/environments/bench
terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
bash scripts/terraform-plan.sh terraform/environments/bench
env:
TF_ENV: production

deploy-production:
name: Deploy Production - bench
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
environment:
name: bench-production
steps:
- name: Checkout Repository
uses: actions/[email protected]
- name: Load and Configure Terraform
uses: hashicorp/[email protected]
with:
terraform_version: 0.14.6
terraform_wrapper: false
- name: Terraform apply - production
run: |
echo "Terraform apply - ${TF_ENV}"
bash scripts/terraform-init.sh terraform/environments/bench
terraform -chdir="terraform/environments/bench" workspace select "bench-${TF_ENV}"
bash scripts/terraform-apply.sh terraform/environments/bench
env:
TF_ENV: production
Loading