1
- name : Test
1
+ name : Test and Deploy
2
2
on :
3
3
push :
4
4
branches : [ '*' ]
@@ -21,42 +21,55 @@ jobs:
21
21
dependencies :
22
22
- " lowest"
23
23
- " highest"
24
-
25
24
steps :
26
- - name : Checkout php-http-client
27
- uses : actions/checkout@v2
25
+ - name : Checkout php-http-client
26
+ uses : actions/checkout@v2
27
+
28
+ - name : Setup PHP Action
29
+ uses :
shivammathur/[email protected]
30
+ with :
31
+ php-version : ${{ matrix.php }}
32
+ id : php
33
+
34
+ - name : Composer webhook config
35
+ run : composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
28
36
29
- - name : Setup PHP Action
30
- uses :
shivammathur/[email protected]
31
- with :
32
- php-version : ${{ matrix.php }}
33
- id : php
37
+ - name : Install dependencies
38
+ run : composer install
34
39
35
- - name : Composer webhook config
36
- run : composer config -g github-oauth.github.com ${{ secrets.GITHUB_TOKEN }}
40
+ - name : Update Dependencies
41
+ if : ${{ matrix.dependencies == 'lowest' }}
42
+ run : composer update --prefer-lowest --prefer-stable -n
37
43
38
- - name : Install dependencies
39
- run : composer install
44
+ - name : Run Tests
45
+ run : make test
40
46
41
- - name : Update Dependencies
42
- if : ${{ matrix.dependencies == 'lowest' }}
43
- run : composer update --prefer-lowest --prefer-stable -n
47
+ deploy :
48
+ name : Deploy
49
+ if : success() && github.ref_type == 'tag'
50
+ needs : [ test ]
51
+ runs-on : ubuntu-latest
52
+ steps :
53
+ - name : Checkout php-http-client
54
+ uses : actions/checkout@v2
44
55
45
- - name : Run Tests
46
- run : make test
56
+ - name : Create GitHub Release
57
+ uses : sendgrid/dx-automator/actions/release@main
58
+ env :
59
+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
47
60
48
61
notify-on-failure :
49
62
name : Slack notify on failure
50
- if : ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
51
- needs : [test]
63
+ if : failure() && github.event_name != 'pull_request' && (github. ref == 'refs/heads/main' || github.ref_type == 'tag')
64
+ needs : [ test, deploy ]
52
65
runs-on : ubuntu-latest
53
66
steps :
54
67
- uses : rtCamp/action-slack-notify@v2
55
68
env :
56
69
SLACK_COLOR : failure
57
70
SLACK_ICON_EMOJI : ' :github:'
58
- SLACK_MESSAGE : ${{ format('Build {2} in {1} failed{3} {0}/{1 }/actions/runs/{2 }', github.server_url, github.repository, github.run_id, ':' ) }}
59
- SLACK_TITLE : Build Failure
71
+ SLACK_MESSAGE : ${{ format('Tests *{0}*, Deploy * {1}*, {2}/{3 }/actions/runs/{4 }', needs.test.result, needs.deploy.result, github.server_url, github.repository, github.run_id) }}
72
+ SLACK_TITLE : Action Failure - ${{ github.repository }}
60
73
SLACK_USERNAME : GitHub Actions
61
74
SLACK_MSG_AUTHOR : twilio-dx
62
75
SLACK_FOOTER : Posted automatically using GitHub Actions
0 commit comments