Skip to content

Commit

Permalink
two jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Varner committed May 20, 2024
1 parent 3ddc597 commit 27eee9b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 33 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/deploy-prod.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 🚀 Deploy Prod

on:
push:

jobs:
deploy-prod:
uses: ./.github/workflows/reusable-deploy.yaml
secrets: inherit
concurrency: prod
with:
stage: prod
url: https://console.modelmywatershed.org
fd-aws-tf-modules-version: v2.23.0
14 changes: 14 additions & 0 deletions .github/workflows/deploy-staging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: 🚀 Deploy Staging

on:
push:

jobs:
deploy-staging:
uses: ./.github/workflows/reusable-deploy.yaml
secrets: inherit
concurrency: staging
with:
stage: staging
url: https://console.staging.modelmywatershed.org
fd-aws-tf-modules-version: v2.23.0
25 changes: 0 additions & 25 deletions .github/workflows/deploy.yaml

This file was deleted.

26 changes: 18 additions & 8 deletions .github/workflows/reusable-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,23 @@ on:
required: true
type: string

env:
project-name: mmw

permissions:
id-token: write
contents: read

jobs:
reusable-deploy:
reusable-validate:
environment:
name: ${{ inputs.stage }}
url: ${{ inputs.url }}
env:
project-name: mmw
permissions:
id-token: write
contents: read

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.7.5"
Expand Down Expand Up @@ -75,6 +78,13 @@ jobs:
id: tf_plan
run: terraform plan -var-file="${{ inputs.stage }}.tfvars" -out ${{ inputs.stage }}.tfplan -lock=false

reusable-deploy:
needs: ["reusable-validate"]
environment:
name: ${{ inputs.stage }}
url: ${{ inputs.url }}
runs-on: ubuntu-latest
steps:
- name: Configure Terraform Apply Credentials
id: apply_creds
uses: aws-actions/configure-aws-credentials@v4
Expand Down Expand Up @@ -107,4 +117,4 @@ jobs:
channel-id: ${{ secrets.SLACK_CHANNEL_ID }}
slack-message: ":sadpanda: ${{ env.project-name }}-${{ inputs.stage }}-titiler ${{ github.ref_name }} terraform apply has failed!\n:alert: make sure cleanup job deletes all AWS resources!\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}

0 comments on commit 27eee9b

Please sign in to comment.