Skip to content

Commit f1427d2

Browse files
chore: merge test and deploy workflows
1 parent 732dcc9 commit f1427d2

File tree

3 files changed

+29
-51
lines changed

3 files changed

+29
-51
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 42 deletions
This file was deleted.

.github/workflows/test.yml renamed to .github/workflows/test-and-deploy.yml

Lines changed: 28 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
name: Tests
1+
name: Test and Deploy
22
on:
33
push:
44
branches: [ '*' ]
5+
tags: [ '*' ]
56
pull_request:
67
branches: [ main ]
78
schedule:
@@ -10,8 +11,8 @@ on:
1011
workflow_dispatch:
1112

1213
jobs:
13-
tests:
14-
name: Run Tests
14+
test:
15+
name: Test
1516
runs-on: ubuntu-latest
1617
timeout-minutes: 20
1718
steps:
@@ -30,18 +31,37 @@ jobs:
3031
run: make test-docker release
3132
- run: bash <(curl -s https://codecov.io/bash)
3233

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+
uses: actions/[email protected]
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+
3353
notify-on-failure:
3454
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 ]
3757
runs-on: ubuntu-latest
3858
steps:
3959
- uses: rtCamp/action-slack-notify@v2
4060
env:
41-
SLACK_COLOR: 'danger'
61+
SLACK_COLOR: failure
4262
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 }}
4565
SLACK_USERNAME: GitHub Actions
4666
SLACK_MSG_AUTHOR: twilio-dx
4767
SLACK_FOOTER: Posted automatically using GitHub Actions

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
![SendGrid Logo](twilio_sendgrid_logo.png)
22

3-
[![BuildStatus](https://github.com/sendgrid/sendgrid-csharp/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/sendgrid-csharp/actions/workflows/test.yml)
3+
[![Test and Deploy](https://github.com/sendgrid/sendgrid-csharp/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/sendgrid-csharp/actions/workflows/test-and-deploy.yml)
44
[![NuGet](https://img.shields.io/nuget/v/SendGrid.svg)](https://www.nuget.org/packages/SendGrid)
55
[![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
66
[![Twitter Follow](https://img.shields.io/twitter/follow/sendgrid.svg?style=social&label=Follow)](https://twitter.com/sendgrid)

0 commit comments

Comments
 (0)