4
4
push :
5
5
branches :
6
6
- main
7
-
8
7
jobs :
9
8
deploy :
10
9
name : Deploy app
@@ -13,55 +12,39 @@ jobs:
13
12
steps :
14
13
- name : Checkout ποΈ
15
14
uses : actions/checkout@v4
16
-
15
+
17
16
- name : Setup Fly π§°
18
17
uses : superfly/flyctl-actions/setup-flyctl@master
19
18
20
- - name : Install GitHub CLI π
21
- uses : actions/setup-gh@v3
22
-
23
- - name : Create GitHub Deployment π’
19
+ - name : Create GitHub Deployment π
24
20
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 }}
21
+ uses : octokit/request-action@v2.3.1
22
+ with :
23
+ route : POST /repos/${{ github.repository }}/deployments
24
+ environment : production
25
+ ref : ${{ github.sha }}
26
+ description : " Deploying to Fly.io"
27
+ auto_merge : false
40
28
41
29
- name : Deploy to Fly.io π©οΈ
42
- id : deploy
43
30
run : flyctl deploy --remote-only
44
31
env :
45
32
FLY_API_TOKEN : ${{ secrets.FLY_TOKEN }}
33
+
34
+ - name : Set deployment status to success β
35
+ if : success()
36
+ uses : octokit/request-action@v2.3.1
37
+ with :
38
+ route : POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses
39
+ state : success
40
+ description : " β
Deployment Succeeded π₯³"
41
+ environment : production
46
42
47
- - name : Update GitHub Deployment Status to Success β
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 }}
57
-
58
- - name : Update GitHub Deployment Status to Failure π«
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 }}
43
+ - name : Set deployment status to failure β
44
+ if : failure()
45
+ uses : octokit/request-action@v2.3.1
46
+ with :
47
+ route : POST /repos/${{ github.repository }}/deployments/${{ steps.create_deployment.outputs.id }}/statuses
48
+ state : failure
49
+ description : " β Deployment Failed π₯"
50
+ environment : production
0 commit comments