Skip to content

Commit 512061a

Browse files
authored
Add deployment workflows for staging, development, and production environments (#38)
1 parent 7971a0d commit 512061a

File tree

5 files changed

+100
-68
lines changed

5 files changed

+100
-68
lines changed

.github/actions/deploy/action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ runs:
2929
uses: ./.github/actions/slack
3030
with:
3131
message: "deploying ${{ inputs.image }} to ${{ inputs.environment }} :rocket:"
32-
webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
32+
webhook_url: ${{ inputs.slack_webhook_url }}
3333
- name: Deploy flyctl
3434
shell: bash
3535
run: |
@@ -49,11 +49,11 @@ runs:
4949
uses: ./.github/actions/slack
5050
with:
5151
message: ":tada: Successfully deployed ${{ inputs.image }} to ${{ inputs.environment }} :white_check_mark:!"
52-
webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
52+
webhook_url: ${{ inputs.slack_webhook_url }}
5353
- name: Notify (failed deployment)
5454
if: failure()
5555
uses: ./.github/actions/slack
5656
with:
5757
message: ":fail: Failed to deploy to ${{ inputs.environment }} :red_flag:!"
58-
webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
58+
webhook_url: ${{ inputs.slack_webhook_url }}
5959

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Deploy (staging)
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
concurrency:
8+
group: ${{ github.event_name }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
deploy:
13+
if: ${{ github.event_name == 'workflow_dispatch' }}
14+
runs-on: ubuntu-latest
15+
environment:
16+
name: development
17+
url: https://test-github-features-development.fly.dev
18+
steps:
19+
- uses: actions/checkout@v2
20+
- id: build
21+
uses: ./.github/actions/build
22+
with:
23+
push: true
24+
username: ${{ github.actor}}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Deploy
28+
uses: ./.github/actions/deploy
29+
with:
30+
environment: development
31+
token: ${{ secrets.FLY_TOKEN }}
32+
image: ${{ steps.build.outputs.tags }}
33+
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Deploy (production)
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency:
9+
group: ${{ github.event_name }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
deploy:
14+
runs-on: ubuntu-latest
15+
environment:
16+
name: production
17+
url: https://test-github-features.fly.dev
18+
steps:
19+
- uses: actions/checkout@v2
20+
- id: build
21+
uses: ./.github/actions/build
22+
with:
23+
push: true
24+
username: ${{ github.actor}}
25+
password: ${{ secrets.GITHUB_TOKEN }}
26+
27+
- name: Deploy
28+
uses: ./.github/actions/deploy
29+
with:
30+
environment: production
31+
token: ${{ secrets.FLY_TOKEN }}
32+
image: ${{ steps.build.outputs.tags }}
33+
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/deploy.staging.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Deploy (staging)
2+
3+
on:
4+
merge_group:
5+
6+
concurrency:
7+
group: ${{ github.event_name }}
8+
cancel-in-progress: true
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
environment:
14+
name: staging
15+
url: https://test-github-features-staging.fly.dev
16+
steps:
17+
- uses: actions/checkout@v2
18+
- id: build
19+
uses: ./.github/actions/build
20+
with:
21+
push: true
22+
username: ${{ github.actor}}
23+
password: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Deploy
26+
uses: ./.github/actions/deploy
27+
with:
28+
environment: staging
29+
token: ${{ secrets.FLY_TOKEN }}
30+
image: ${{ steps.build.outputs.tags }}
31+
slack_webhook_url: ${{ secrets.SLACK_WEBHOOK_URL }}

.github/workflows/deploy.yml

Lines changed: 0 additions & 65 deletions
This file was deleted.

0 commit comments

Comments
 (0)