-
Notifications
You must be signed in to change notification settings - Fork 303
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: migrate to using gh actions (#583)
* chore: migrate to using gh actions
- Loading branch information
1 parent
983aba9
commit 7dfd518
Showing
5 changed files
with
101 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Deploy | ||
on: | ||
push: | ||
tags: | ||
- '*' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
deploy: | ||
name: Deploy | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout twilio-csharp | ||
uses: actions/checkout@v2 | ||
|
||
- name: Login to Docker Hub | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_TOKEN }} | ||
|
||
# The expression strips off the shortest match from the front of the string to yield just the tag name as the output | ||
- name: Get tagged version | ||
run: echo "GITHUB_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | ||
|
||
- name: Build and Push image | ||
run: make docker-build docker-push | ||
|
||
- name: Setup .NET Core SDK | ||
uses: actions/setup-dotnet@v1.8.2 | ||
with: | ||
dotnet-version: '3.1.x' | ||
|
||
- name: Publish package to NuGet | ||
run: dotnet nuget push **/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json | ||
|
||
notify-on-failure: | ||
name: Slack notify on failure | ||
if: ${{ failure() }} | ||
needs: [ deploy ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_COLOR: 'danger' | ||
SLACK_ICON_EMOJI: ':github:' | ||
SLACK_MESSAGE: ${{ format('Failed to deploy {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} | ||
SLACK_TITLE: Deployment Failure | ||
SLACK_USERNAME: GitHub Actions | ||
SLACK_MSG_AUTHOR: twilio-dx | ||
SLACK_FOOTER: Posted automatically using GitHub Actions | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
MSG_MINIMAL: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Tests | ||
on: | ||
push: | ||
branches: [ '*' ] | ||
pull_request: | ||
branches: [ main ] | ||
schedule: | ||
# Run automatically at 8AM PST Monday-Friday | ||
- cron: '0 15 * * 1-5' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tests: | ||
name: Run Tests | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 20 | ||
steps: | ||
- name: Checkout twilio-csharp | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup .NET Core SDK | ||
uses: actions/setup-dotnet@v1.8.2 | ||
with: | ||
dotnet-version: '3.1.x' | ||
|
||
- name: Build & Test | ||
run: make test release | ||
|
||
notify-on-failure: | ||
name: Slack notify on failure | ||
if: ${{ failure() && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' }} | ||
needs: [ tests ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: rtCamp/action-slack-notify@v2 | ||
env: | ||
SLACK_COLOR: 'danger' | ||
SLACK_ICON_EMOJI: ':github:' | ||
SLACK_MESSAGE: ${{ format('Failed running build on {1}{3} {0}/{1}/actions/runs/{2}', github.server_url, github.repository, github.run_id, ':') }} | ||
SLACK_TITLE: Build Failure | ||
SLACK_USERNAME: GitHub Actions | ||
SLACK_MSG_AUTHOR: twilio-dx | ||
SLACK_FOOTER: Posted automatically using GitHub Actions | ||
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }} | ||
MSG_MINIMAL: true |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters