-
Notifications
You must be signed in to change notification settings - Fork 1
82 lines (75 loc) · 2.6 KB
/
fly-deploy.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# Deploys a single service to fly based on inputs provided
# does nothing if no fly.toml exists
name: 'Deploy to Fly'
env:
# renovate: datasource=github-releases depName=superfly/flyctl versioning=semver
FLY_CLI_VERSION: '0.3.57'
on:
workflow_call:
inputs:
service:
description: 'The name of the service (name of the directory).'
type: string
required: true
app:
description: 'The name of the app on Fly.'
type: string
required: true
organization:
description: 'The name of the organization on Fly.'
type: string
required: true
version:
description: "The version of the app."
type: string
required: false
environment:
description:
Which config file to choose.
Currently either "staging" or "production".
If no such fly.<environment>.toml exists, we fallback to fly.toml.
type: string
required: false
default: ""
concurrency:
group: ${{ github.workflow }}-${{ inputs.app }}
cancel-in-progress: true
jobs:
fly-toml:
runs-on: ubuntu-22.04
outputs:
fly_toml: ${{ steps.fly-toml.outputs.fly_toml }}
steps:
- uses: actions/checkout@v4
- name: Does a fly.toml exist?
id: fly-toml
run: |
# fallback to fly.toml if needed
fly_toml=$([ "$suggested_fly_toml" = "fly..toml" ] && echo "fly.toml" || echo "$suggested_fly_toml")
# only set if it exists
echo "fly_toml=$((test -f services/$service/$fly_toml && echo $fly_toml) || (test -f services/$service/fly.toml && echo fly.toml))" >> $GITHUB_OUTPUT
env:
service: ${{ inputs.service }}
suggested_fly_toml: fly.${{ inputs.environment }}.toml
deploy:
runs-on: ubuntu-22.04
needs: fly-toml
if: ${{ needs.fly-toml.outputs.fly_toml != '' }}
env:
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: Configure Dapr for deployment
run: sed -i "s/helpwave-staging/$organization/g" dapr/config.yaml
env:
organization: ${{ inputs.organization }}
- name: Setup flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
with:
version: ${{ env.FLY_CLI_VERSION }}
- name: Deploy
run: |
flyctl deploy --config services/${{ inputs.service }}/${{ needs.fly-toml.outputs.fly_toml }} --app ${{ inputs.app }} --build-arg VERSION=${{ inputs.version }} --remote-only --wait-timeout=2m
env:
DOCKER_BUILDKIT: 1