Skip to content

Commit bf9dfb9

Browse files
chore: merge test and deploy workflows (#107)
1 parent a7c1fca commit bf9dfb9

File tree

4 files changed

+64
-89
lines changed

4 files changed

+64
-89
lines changed

.github/workflows/release.yml

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

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

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Test and Deploy
2+
on:
3+
push:
4+
branches: [ '*' ]
5+
tags: [ '*' ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
# Run automatically at 8AM PST Monday-Friday
10+
- cron: '0 15 * * 1-5'
11+
workflow_dispatch:
12+
13+
jobs:
14+
test:
15+
name: Test
16+
runs-on: ubuntu-latest
17+
timeout-minutes: 20
18+
steps:
19+
- uses: actions/checkout@v2
20+
21+
- name: Setup .NET Core SDK
22+
uses: actions/[email protected]
23+
with:
24+
dotnet-version: '3.1.x'
25+
26+
- name: Build & Test
27+
run: make test
28+
- run: bash <(curl -s https://codecov.io/bash)
29+
deploy:
30+
name: Deploy
31+
if: success() && github.ref_type == 'tag'
32+
needs: [ test ]
33+
runs-on: ubuntu-latest
34+
steps:
35+
- uses: actions/checkout@v2
36+
37+
- name: Setup .NET Core SDK
38+
uses: actions/[email protected]
39+
with:
40+
dotnet-version: '3.1.x'
41+
42+
- name: Publish package to NuGet
43+
run: |
44+
make test
45+
dotnet nuget push **/SendGrid*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json
46+
47+
notify-on-failure:
48+
name: Slack notify on failure
49+
if: failure() && github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref_type == 'tag')
50+
needs: [ test, deploy ]
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: rtCamp/action-slack-notify@v2
54+
env:
55+
SLACK_COLOR: failure
56+
SLACK_ICON_EMOJI: ':github:'
57+
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) }}
58+
SLACK_TITLE: Action Failure - ${{ github.repository }}
59+
SLACK_USERNAME: GitHub Actions
60+
SLACK_MSG_AUTHOR: twilio-dx
61+
SLACK_FOOTER: Posted automatically using GitHub Actions
62+
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
63+
MSG_MINIMAL: true

.github/workflows/test.yml

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

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/csharp-http-client/actions/workflows/test.yml/badge.svg)](https://github.com/sendgrid/csharp-http-client/actions/workflows/test.yml)
3+
[![Test and Deploy](https://github.com/sendgrid/csharp-http-client/actions/workflows/test-and-deploy.yml/badge.svg)](https://github.com/sendgrid/csharp-http-client/actions/workflows/test-and-deploy.yml)
44
[![NuGet](https://img.shields.io/nuget/v/SendGrid.CSharp.Http.Client.svg)](https://www.nuget.org/packages/SendGrid.CSharp.HTTP.Client)
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)