@@ -17,39 +17,51 @@ jobs:
17
17
- name : Setup Fly 🧰
18
18
uses : superfly/flyctl-actions/setup-flyctl@master
19
19
20
+ - name : Install GitHub CLI 🐙
21
+ uses : actions/setup-gh@v3
22
+
23
+ - name : Create GitHub Deployment 🚢
24
+ id : create_deployment
25
+ run : |
26
+ gh auth setup-git
27
+ gh auth status
28
+ gh api repos/${{ github.repository }}/deployments \
29
+ -X POST \
30
+ -F ref=${{ github.ref }} \
31
+ -F environment=production \
32
+ -F description="Deploying the application to Fly.io" \
33
+ -F required_contexts=[] \
34
+ -F auto_merge=false \
35
+ -q '.id' > deployment-id.txt
36
+ DEPLOYMENT_ID=$(cat deployment-id.txt)
37
+ echo "deployment_id=$DEPLOYMENT_ID" >> $GITHUB_ENV
38
+ env :
39
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
40
+
20
41
- name : Deploy to Fly.io 🛩️
21
42
id : deploy
22
43
run : flyctl deploy --remote-only
23
44
env :
24
45
FLY_API_TOKEN : ${{ secrets.FLY_TOKEN }}
25
46
26
- - name : Create GitHub Deployment Status 🚢
27
- id : create_deployment
28
- uses : peter-evans/create-or-update-deployment@v1
29
- with :
30
- token : ${{ secrets.GITHUB_TOKEN }}
31
- environment : production
32
- environment_url : https://api.web-check.xyz
33
- description : " Deploying the application to Fly.io"
34
- transient_environment : false
35
- auto_inactive : true
36
-
37
47
- name : Update GitHub Deployment Status to Success ✅
38
- if : success()
39
- uses : octokit/request-action@v2.3.1
40
- with :
41
- route : POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.deployment_id }}/statuses
42
- token : ${{ secrets.GITHUB_TOKEN }}
43
- state : success
44
- environment_url : https://api.web-check.xyz
45
- description : ' ✅ Deployment successful! 🥳'
48
+ if : ${{ success() }}
49
+ run : |
50
+ gh api repos/${{ github.repository }}/deployments/${{ env.deployment_id }}/statuses \
51
+ -X POST \
52
+ -F state=success \
53
+ -F environment_url=https://api.web-check.xyz \
54
+ -F description='✅ Deployment successful! 🥳'
55
+ env :
56
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
46
57
47
58
- name : Update GitHub Deployment Status to Failure 🚫
48
- if : failure()
49
- uses : octokit/request-action@v2.3.1
50
- with :
51
- route : POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.deployment_id }}/statuses
52
- token : ${{ secrets.GITHUB_TOKEN }}
53
- state : failure
54
- environment_url : https://api.web-check.xyz
55
- description : ' 🚫 Deployment failed 😥'
59
+ if : ${{ failure() }}
60
+ run : |
61
+ gh api repos/${{ github.repository }}/deployments/${{ env.deployment_id }}/statuses \
62
+ -X POST \
63
+ -F state=failure \
64
+ -F environment_url=https://api.web-check.xyz \
65
+ -F description='🚫 Deployment failed 😥'
66
+ env :
67
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments