From 638c0ace453747996854e810a1c59d6a5c9915c8 Mon Sep 17 00:00:00 2001
From: Sean Hammond <seanh@users.noreply.github.com>
Date: Thu, 4 Jan 2024 16:25:21 +0000
Subject: [PATCH] Add the staging environment(s) to `[re]deploy.yml`

---
 .../includes/.github/workflows/environments.json  |  7 +++++++
 .github/workflows/deploy.yml                      | 13 +++++++++++++
 .github/workflows/redeploy.yml                    | 15 +++++++++++++++
 3 files changed, 35 insertions(+)

diff --git a/.cookiecutter/includes/.github/workflows/environments.json b/.cookiecutter/includes/.github/workflows/environments.json
index 1dcaf07..85c6340 100644
--- a/.cookiecutter/includes/.github/workflows/environments.json
+++ b/.cookiecutter/includes/.github/workflows/environments.json
@@ -6,6 +6,13 @@
     "elasticbeanstalk_application": "h-periodic",
     "elasticbeanstalk_environment": "qa"
   },
+  "staging": {
+    "github_environment_name": "Staging",
+    "github_environment_url": "https://my.papertrailapp.com/groups/38981358/events",
+    "aws_region": "us-west-1",
+    "elasticbeanstalk_application": "h-periodic",
+    "elasticbeanstalk_environment": "staging"
+  },
   "production": {
     "needs": ["qa"],
     "github_environment_name": "Production",
diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml
index 2968724..56ff9aa 100644
--- a/.github/workflows/deploy.yml
+++ b/.github/workflows/deploy.yml
@@ -45,6 +45,19 @@ jobs:
       elasticbeanstalk_environment: qa
       docker_tag: ${{ needs.Docker_Hub.outputs.docker_tag }}
     secrets: inherit
+  staging:
+    name: Staging
+    needs: [docker_hub]
+    uses: hypothesis/workflows/.github/workflows/deploy.yml@main
+    with:
+      operation: deploy
+      github_environment_name: Staging
+      github_environment_url: https://my.papertrailapp.com/groups/38981358/events
+      aws_region: us-west-1
+      elasticbeanstalk_application: h-periodic
+      elasticbeanstalk_environment: staging
+      docker_tag: ${{ needs.Docker_Hub.outputs.docker_tag }}
+    secrets: inherit
   production:
     name: Production
     needs: [docker_hub, qa]
diff --git a/.github/workflows/redeploy.yml b/.github/workflows/redeploy.yml
index 5809e56..f071250 100644
--- a/.github/workflows/redeploy.yml
+++ b/.github/workflows/redeploy.yml
@@ -8,6 +8,9 @@ on:
       qa:
         type: boolean
         description: Redeploy QA
+      staging:
+        type: boolean
+        description: Redeploy Staging
       production:
         type: boolean
         description: Redeploy Production
@@ -27,6 +30,18 @@ jobs:
       elasticbeanstalk_application: h-periodic
       elasticbeanstalk_environment: qa
     secrets: inherit
+  staging:
+    name: Staging
+    if: inputs.staging
+    uses: hypothesis/workflows/.github/workflows/deploy.yml@main
+    with:
+      operation: redeploy
+      github_environment_name: Staging
+      github_environment_url: https://my.papertrailapp.com/groups/38981358/events
+      aws_region: us-west-1
+      elasticbeanstalk_application: h-periodic
+      elasticbeanstalk_environment: staging
+    secrets: inherit
   production:
     name: Production
     if: inputs.production