Skip to content

Commit

Permalink
ci: deploy to dev-orange with PR label (#11)
Browse files Browse the repository at this point in the history
* ci: deploy to dev-orange with PR label

* improve human-readable references to PRs

* set more useful run name on manual deploys
  • Loading branch information
boringcactus authored Nov 15, 2023
1 parent 186d7cd commit 5198759
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/deploy-dev-orange.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
name: Deploy to Dev-Orange
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Deploy {0} {1} to Dev-Orange', github.ref_type, github.ref_name) || '' }}

on:
workflow_dispatch:
pull_request:
types:
- synchronize
- labeled

jobs:
deploy:
name: Deploy ${{ github.ref_type }} ${{ github.ref_name }} to Dev-Orange
name: Deploy ${{ github.event_name == 'pull_request' && 'PR' || github.ref_type }} ${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }} to Dev-Orange
if: ${{ github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'deploy to dev-orange') }}
uses: ./.github/workflows/deploy.yml
with:
env: dev-orange
deploy-desc: ${{ github.event_name == 'pull_request' && 'PR' || github.ref_type }} ${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref_name }}
secrets: inherit
2 changes: 2 additions & 0 deletions .github/workflows/deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Deploy to Staging
run-name: ${{ github.event_name == 'workflow_dispatch' && format('Deploy {0} {1} to Staging', github.ref_type, github.ref_name) || '' }}

on:
workflow_dispatch:
Expand All @@ -11,4 +12,5 @@ jobs:
uses: ./.github/workflows/deploy.yml
with:
env: staging
deploy-desc: ${{ github.ref_type }} ${{ github.ref_name }}
secrets: inherit
6 changes: 5 additions & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ on:
version-name:
required: false
type: string
deploy-desc:
required: true
type: string
description: A description of what was deployed ("branch main", "PR 483", "tag 2023-11-15-1", etc)
secrets:
AWS_ROLE_ARN:
required: true
Expand Down Expand Up @@ -68,4 +72,4 @@ jobs:
with:
webhook-url: ${{ secrets.SLACK_WEBHOOK }}
job-status: ${{ job.status }}
custom-message: Deployed ${{ github.ref_type }} ${{ github.ref_name }} to ${{ inputs.env }}
custom-message: Deployed ${{ inputs.deploy-desc }} to ${{ inputs.env }}

0 comments on commit 5198759

Please sign in to comment.