|
1 |
| -name: Deploy |
| 1 | +name: Deploy SDK |
| 2 | + |
2 | 3 | on:
|
3 | 4 | release:
|
4 | 5 | types:
|
5 | 6 | - published
|
| 7 | + |
| 8 | +env: |
| 9 | + BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} |
| 10 | + BW_USERNAME: ${{ secrets.BW_USERNAME }} |
| 11 | + BW_PASSWORD: ${{ secrets.BW_PASSWORD }} |
| 12 | + BW_USERNAME_FORBIDDEN: ${{ secrets.BW_USERNAME_FORBIDDEN}} |
| 13 | + BW_PASSWORD_FORBIDDEN: ${{ secrets.BW_PASSWORD_FORBIDDEN}} |
| 14 | + BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} |
| 15 | + BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }} |
| 16 | + BW_NUMBER: ${{ secrets.BW_NUMBER }} |
| 17 | + USER_NUMBER: ${{ secrets.USER_NUMBER }} |
| 18 | + BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }} |
| 19 | + MANTECA_ACTIVE_NUMBER: ${{ secrets.MANTECA_ACTIVE_NUMBER }} |
| 20 | + MANTECA_APPLICATION_ID: ${{ secrets.MANTECA_APPLICATION_ID }} |
| 21 | + MANTECA_BASE_URL: ${{ secrets.MANTECA_BASE_URL }} |
| 22 | + MANTECA_IDLE_NUMBER: ${{ secrets.MANTECA_IDLE_NUMBER }} |
| 23 | + OPERATING_SYSTEM: ubuntu-latest |
| 24 | + DOTNET_VERSION: 7.0.x |
| 25 | + |
6 | 26 | jobs:
|
7 |
| - publish: |
8 |
| - name: Publish |
9 |
| - if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }} |
10 |
| - env: |
11 |
| - BW_PROJECT_NAME: Bandwidth.Standard |
12 |
| - BW_PROJECT_TEST_NAME: Bandwidth.StandardTests |
| 27 | + deploy_pre_release: |
| 28 | + name: Deploy OpenAPI Generator Client Pre-Release |
| 29 | + if: ${{ github.event.release.prerelease && github.event.release.target_commitish == 'feature/openapi-generator-sdk' }} |
13 | 30 | runs-on: ubuntu-latest
|
14 |
| - steps: |
15 |
| - - uses: actions/checkout@v3 |
16 |
| - |
| 31 | + env: |
| 32 | + BW_PROJECT_NAME: src/Bandwidth.Standard |
| 33 | + BW_PROJECT_TEST_NAME: src/Bandwidth.Standard.Test |
| 34 | + steps: |
17 | 35 | - name: Set release version
|
18 | 36 | run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
|
| 37 | + |
| 38 | + - name: Check Release Tag Format |
| 39 | + run: | |
| 40 | + if ! [[ $RELEASE_VERSION =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(beta|alpha|rc))(\.[0-9][0-9]*)?$ ]]; then |
| 41 | + echo 'Tag does not match expected regex pattern for beta releases (^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-(beta|alpha|rc))(\.[0-9][0-9]*)?$)' |
| 42 | + echo $RELEASE_VERSION |
| 43 | + echo 'Please update your tag to match the expected regex pattern' |
| 44 | + exit 1 |
| 45 | + fi |
| 46 | + |
| 47 | + - name: Checkout |
| 48 | + uses: actions/checkout@v3 |
| 49 | + with: |
| 50 | + ref: feature/openapi-generator-sdk |
19 | 51 |
|
20 |
| - - uses: actions/setup-dotnet@v3 |
| 52 | + - name: Setup Dotnet |
| 53 | + uses: actions/setup-dotnet@v1 |
21 | 54 | with:
|
22 |
| - dotnet-version: "6.0" |
| 55 | + dotnet-version: '7.0.x' |
23 | 56 |
|
24 |
| - - name: Run integration tests |
25 |
| - env: |
26 |
| - BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} |
27 |
| - BW_USERNAME: ${{ secrets.BW_USERNAME }} |
28 |
| - BW_PASSWORD: ${{ secrets.BW_PASSWORD }} |
29 |
| - BW_VOICE_APPLICATION_ID: ${{ secrets.BW_VOICE_APPLICATION_ID }} |
30 |
| - BW_MESSAGING_APPLICATION_ID: ${{ secrets.BW_MESSAGING_APPLICATION_ID }} |
31 |
| - BW_NUMBER: ${{ secrets.BW_NUMBER }} |
32 |
| - USER_NUMBER: ${{ secrets.USER_NUMBER }} |
33 |
| - BASE_CALLBACK_URL: ${{ secrets.BASE_CALLBACK_URL }} |
| 57 | + - name: Run functional tests |
34 | 58 | run: dotnet test $BW_PROJECT_TEST_NAME
|
35 |
| - |
| 59 | + |
36 | 60 | - name: Pack NuGet package
|
37 | 61 | run: dotnet pack --configuration Release $BW_PROJECT_NAME -p:PackageVersion=$RELEASE_VERSION
|
| 62 | + |
| 63 | + - name: Publish NuGet package |
| 64 | + env: |
| 65 | + NUGET_KEY: ${{ secrets.NUGET_KEY }} |
| 66 | + NUGET_SOURCE: https://api.nuget.org/v3/index.json |
| 67 | + run: dotnet nuget push $BW_PROJECT_NAME/bin/Release/*.nupkg -s $NUGET_SOURCE -k $NUGET_KEY |
38 | 68 |
|
| 69 | + - name: Notify Slack of build status |
| 70 | + uses: Bandwidth/build-notify-slack-action@v1.0.0 |
| 71 | + if: always() |
| 72 | + with: |
| 73 | + job-status: ${{ job.status }} |
| 74 | + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} |
| 75 | + slack-channel: ${{ secrets.SLACK_CHANNEL }} |
| 76 | + |
| 77 | + deploy: |
| 78 | + name: deploy 'main' branch |
| 79 | + if: ${{ !github.event.release.prerelease && github.event.release.target_commitish == 'main' }} |
| 80 | + runs-on: ubuntu-latest |
| 81 | + env: |
| 82 | + BW_PROJECT_NAME: src/Bandwidth.Standard |
| 83 | + BW_PROJECT_TEST_NAME: src/Bandwidth.Standard.Test |
| 84 | + steps: |
| 85 | + - name: Set release version |
| 86 | + run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV |
| 87 | + |
| 88 | + - name: Check Release Tag Format |
| 89 | + run: | |
| 90 | + if ! [[ $RELEASE_VERSION =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then |
| 91 | + echo 'Tag does not match expected regex pattern for releases (^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$)' |
| 92 | + echo $RELEASE_VERSION |
| 93 | + echo 'Please update your tag to match the expected regex pattern' |
| 94 | + exit 1 |
| 95 | + fi |
| 96 | + |
| 97 | + - name: Checkout |
| 98 | + uses: actions/checkout@v3 |
| 99 | + |
| 100 | + - name: Setup Dotnet |
| 101 | + uses: actions/setup-dotnet@v1 |
| 102 | + with: |
| 103 | + dotnet-version: '7.0.x' |
| 104 | + |
| 105 | + - name: Run functional tests |
| 106 | + run: dotnet test $BW_PROJECT_TEST_NAME |
| 107 | + |
| 108 | + - name: Pack NuGet package |
| 109 | + run: dotnet pack --configuration Release $BW_PROJECT_NAME -p:PackageVersion=$RELEASE_VERSION |
| 110 | + |
39 | 111 | - name: Publish NuGet package
|
40 | 112 | env:
|
41 | 113 | NUGET_KEY: ${{ secrets.NUGET_KEY }}
|
42 | 114 | NUGET_SOURCE: https://api.nuget.org/v3/index.json
|
43 | 115 | run: dotnet nuget push $BW_PROJECT_NAME/bin/Release/*.nupkg -s $NUGET_SOURCE -k $NUGET_KEY
|
| 116 | + |
| 117 | + - name: Notify Slack of build status |
| 118 | + uses: Bandwidth/build-notify-slack-action@v1.0.0 |
| 119 | + if: always() |
| 120 | + with: |
| 121 | + job-status: ${{ job.status }} |
| 122 | + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} |
| 123 | + slack-channel: ${{ secrets.SLACK_CHANNEL }} |
0 commit comments