Skip to content

Commit

Permalink
refactored staging apply
Browse files Browse the repository at this point in the history
  • Loading branch information
thejoeker12 committed Nov 8, 2024
1 parent 159c9f7 commit b4f4bf0
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions .github/workflows/demo_2_apply_staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,9 @@ name: Demo | Workflow 2 - Apply Targetted at Staging from Main
run-name: Merge Triggered Apply of Main to Staging

on:

# Manual trigger options - debug only
workflow_dispatch:
inputs:
environment:
description: "Target RTL Environment"
required: true
type: choice
options:
- sandbox
- staging
- production

pull_request:

# When a PR is closed
types:
[closed]

Expand All @@ -32,8 +20,11 @@ on:
jobs:

terraform-upload-plan-apply:

# If the closure type was merged (not rejected)
if: github.event.pull_request.merged == true
environment: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.environment || 'staging' }}

environment: 'staging'
runs-on: ubuntu-latest
env:
TF_API_KEY: ${{ secrets.TF_API_KEY }}
Expand Down Expand Up @@ -72,9 +63,8 @@ jobs:

- name: Save outputs to file
run: |
cat << EOF > ${{ vars.OUTPUTS_FILE_FN }}
cat << EOF > ${{ vars.ARTIFACT_FN }}
{
"pr_number": "${{ github.event.pull_request.number }}",
"status": "${{ steps.terraform-apply.outputs.status }}"
}
EOF
Expand All @@ -84,7 +74,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ vars.APPLY_OUTPUT_ARTIFACT_NAME }}
path: ${{ vars.OUTPUTS_FILE_FN }}
path: ${{ vars.ARTIFACT_FN }}
retention-days: 0


Expand All @@ -93,8 +83,8 @@ jobs:
needs: terraform-upload-plan-apply
uses: ./.github/workflows/update_pr.yml
with:
outputs-payload: ${{ vars.APPLY_OUTPUT_ARTIFACT_NAME }}
run-type: "apply"
artifact-name: ${{ vars.APPLY_OUTPUT_ARTIFACT_NAME }}
target-pr-number: ${{ github.event.pull_request.number }}



Expand Down

0 comments on commit b4f4bf0

Please sign in to comment.