File tree Expand file tree Collapse file tree 5 files changed +137
-84
lines changed Expand file tree Collapse file tree 5 files changed +137
-84
lines changed Original file line number Diff line number Diff line change 1
1
name : ' Deploy to fly'
2
2
description : ' Deploys a published image to fly'
3
3
inputs :
4
+ environment :
5
+ required : true
6
+ description : " Which environment to deploy to"
4
7
image :
5
8
required : true
6
9
description : " Which image to deploy"
7
- config :
8
- required : true
9
- description : " Path to a fly.toml file"
10
10
token :
11
11
required : true
12
12
description : " Access token for flyctl"
13
13
14
14
runs :
15
15
using : ' composite'
16
16
steps :
17
+ - id : config_path
18
+ shell : bash
19
+ run : |
20
+ config_path=${{ github.workspace }}/fly-${{ inputs.environment}}.toml
21
+
22
+ if [ ! -f "$config_path" ]; then
23
+ echo "Could not find config file at $config_path"
24
+ exit 1
25
+ fi
26
+
27
+ echo "path=$config_path" >> $GITHUB_OUTPUT
28
+ - name : Notify (attempt)
29
+ uses : ./.github/actions/slack
30
+ with :
31
+ message : " deploying ${{ inputs.image }} to ${{ inputs.environment }} :rocket:"
32
+ webhook_url : ${{ secrets.SLACK_WEBHOOK_URL }}
17
33
- name : Deploy flyctl
18
34
shell : bash
19
35
run : |
20
36
docker run \
21
37
--rm \
22
- -v ${{ inputs.config }}:/workspace/fly.toml \
38
+ -v ${{ steps.config_path.outputs.path }}:/workspace/fly.toml \
23
39
--workdir /workspace \
24
40
ghcr.io/superfly/flyctl:latest \
25
41
deploy \
28
44
-i ${{ inputs.image }} \
29
45
--yes \
30
46
--verbose
47
+ - name : Notify (scuccessful deployment)
48
+ if : success()
49
+ uses : ./.github/actions/slack
50
+ with :
51
+ message : " :tada: Successfully deployed ${{ inputs.image }} to ${{ inputs.environment }} :white_check_mark:!"
52
+ webhook_url : ${{ secrets.SLACK_WEBHOOK_URL }}
53
+ - name : Notify (failed deployment)
54
+ if : failure()
55
+ uses : ./.github/actions/slack
56
+ with :
57
+ message : " :fail: Failed to deploy to ${{ inputs.environment }} :red_flag:!"
58
+ webhook_url : ${{ secrets.SLACK_WEBHOOK_URL }}
59
+
Original file line number Diff line number Diff line change
1
+ name : Deploy (development)
2
+
3
+ on :
4
+ workflow_dispatch :
5
+
6
+ env :
7
+ environment : development
8
+ url : https://test-github-features-development.fly.dev
9
+
10
+ jobs :
11
+ deploy_development :
12
+ runs-on : ubuntu-latest
13
+ environment :
14
+ name : ${{ github.env.environment }}
15
+ url : ${{ github.env.url }}
16
+ concurrency :
17
+ group : ${{ github.env.environment }}
18
+ cancel-in-progress : true
19
+ steps :
20
+ - uses : actions/checkout@v2
21
+ - id : build
22
+ uses : ./.github/actions/build
23
+ with :
24
+ push : true
25
+ username : ${{ github.actor}}
26
+ password : ${{ secrets.GITHUB_TOKEN }}
27
+
28
+ - name : Deploy
29
+ uses : ./.github/actions/deploy
30
+ with :
31
+ environment : ${{ github.env.environment }}
32
+ token : ${{ secrets.FLY_TOKEN }}
33
+ image : ${{ steps.build.outputs.tags }}
Original file line number Diff line number Diff line change
1
+ name : Deploy (production)
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main
7
+
8
+ env :
9
+ environment : production
10
+ url : https://test-github-features.fly.dev
11
+
12
+ jobs :
13
+ deploy_production :
14
+ runs-on : ubuntu-latest
15
+ environment :
16
+ name : ${{ github.env.environment }}
17
+ url : ${{ github.env.url }}
18
+ concurrency :
19
+ group : ${{ github.env.environment }}
20
+ cancel-in-progress : true
21
+ steps :
22
+ - uses : actions/checkout@v2
23
+ - id : build
24
+ uses : ./.github/actions/build
25
+ with :
26
+ push : true
27
+ username : ${{ github.actor}}
28
+ password : ${{ secrets.GITHUB_TOKEN }}
29
+
30
+ - name : Deploy
31
+ uses : ./.github/actions/deploy
32
+ with :
33
+ environment : ${{ github.env.environment }}
34
+ token : ${{ secrets.FLY_TOKEN }}
35
+ image : ${{ steps.build.outputs.tags }}
Original file line number Diff line number Diff line change
1
+ name : Deploy (staging)
2
+
3
+ on :
4
+ merge_group :
5
+ pull_request :
6
+
7
+
8
+ env :
9
+ environment : staging
10
+ url : https://test-github-features-staging.fly.dev
11
+
12
+ jobs :
13
+ deploy_staging :
14
+ if : ${{ github.event_name == 'merge_group' }}
15
+ runs-on : ubuntu-latest
16
+ environment :
17
+ name : ${{ github.env.environment }}
18
+ url : ${{ github.env.url }}
19
+ concurrency :
20
+ group : ${{ github.env.environment }}
21
+ cancel-in-progress : true
22
+ steps :
23
+ - uses : actions/checkout@v2
24
+ - id : build
25
+ uses : ./.github/actions/build
26
+ with :
27
+ push : true
28
+ username : ${{ github.actor}}
29
+ password : ${{ secrets.GITHUB_TOKEN }}
30
+
31
+ - name : Deploy
32
+ uses : ./.github/actions/deploy
33
+ with :
34
+ environment : ${{ github.env.environment }}
35
+ token : ${{ secrets.FLY_TOKEN }}
36
+ image : ${{ steps.build.outputs.tags }}
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments