1
- name : Tests
1
+ name : Test and Deploy
2
2
on :
3
3
push :
4
4
branches : [ '*' ]
5
+ tags : [ '*' ]
5
6
pull_request :
6
7
branches : [ main ]
7
8
schedule :
10
11
workflow_dispatch :
11
12
12
13
jobs :
13
- tests :
14
- name : Run Tests
14
+ test :
15
+ name : Test
15
16
runs-on : ubuntu-latest
16
17
timeout-minutes : 20
17
18
steps :
@@ -30,18 +31,37 @@ jobs:
30
31
run : make test-docker release
31
32
- run : bash <(curl -s https://codecov.io/bash)
32
33
34
+ deploy :
35
+ name : Deploy
36
+ if : success() && github.ref_type == 'tag'
37
+ needs : [ test ]
38
+ runs-on : ubuntu-latest
39
+ steps :
40
+ - name : Checkout sendgrid-csharp
41
+ uses : actions/checkout@v2
42
+
43
+ - name : Setup .NET Core SDK
44
+
45
+ with :
46
+ dotnet-version : ' 3.1.x'
47
+
48
+ - name : Publish package to NuGet
49
+ run : |
50
+ make release
51
+ dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate
52
+
33
53
notify-on-failure :
34
54
name : Slack notify on failure
35
- if : ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }}
36
- needs : [ tests ]
55
+ if : failure() && github.event_name != 'pull_request' && (github. ref == 'refs/heads/main' || github.ref_type == 'tag')
56
+ needs : [ test, deploy ]
37
57
runs-on : ubuntu-latest
38
58
steps :
39
59
- uses : rtCamp/action-slack-notify@v2
40
60
env :
41
- SLACK_COLOR : ' danger '
61
+ SLACK_COLOR : failure
42
62
SLACK_ICON_EMOJI : ' :github:'
43
- SLACK_MESSAGE : ${{ format('Failed running build on {1}{3} {0 }/{1 }/actions/runs/{2 }', github.server_url, github.repository, github.run_id, ':' ) }}
44
- SLACK_TITLE : Build Failure
63
+ 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) }}
64
+ SLACK_TITLE : Action Failure - ${{ github.repository }}
45
65
SLACK_USERNAME : GitHub Actions
46
66
SLACK_MSG_AUTHOR : twilio-dx
47
67
SLACK_FOOTER : Posted automatically using GitHub Actions
0 commit comments