diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 7c6d56ff..76b6658c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -7,7 +7,7 @@ on: jobs: deploy: - name: Deploy SDK to Rubygems # TODO: Decide on putting env vars in vault after we decide on mocking integration tests + name: Deploy SDK to Rubygems runs-on: ubuntu-latest env: BW_ACCOUNT_ID: ${{ secrets.BW_ACCOUNT_ID }} @@ -36,7 +36,7 @@ jobs: if [[ $RELEASE_VERSION =~ $re ]]; then echo "GEM_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV else - echo "Tag does not match expected regex pattern for beta releases (v$re)" + echo "Tag does not match expected semver regex pattern (v$re)" echo $RELEASE_VERSION echo 'Please update your tag to match the expected regex pattern' exit 1 @@ -50,6 +50,9 @@ jobs: with: ruby-version: "3.0" + - name: Update Gem Version + run: sed -i "s/VERSION = '.*'/VERSION = '$GEM_VERSION'/g" lib/bandwidth-sdk/version.rb + - name: Install Packages and Test run: | bundle install diff --git a/.github/workflows/update-sdk.yml b/.github/workflows/update-sdk.yml index 07be1aa8..b4d9ad56 100644 --- a/.github/workflows/update-sdk.yml +++ b/.github/workflows/update-sdk.yml @@ -8,28 +8,17 @@ on: jobs: update-sdk: name: Update SDK if Necessary - runs-on: ${{ fromJSON(vars.SWI_GLORG_UBUNTU_2204) }} + runs-on: ubuntu-latest outputs: generate: ${{ steps.compare.outputs.generate }} - permissions: - id-token: write - contents: write steps: - - name: Get Github and Jira Tokens from Vault - uses: Bandwidth/vault-provider-action@v1 - with: - secrets: | - workloads/prod/software_infra::secrets:dx-github-token:dx-github-token@1::DX_GITHUB_TOKEN - workloads/prod/software_infra::secrets:SDLC-Enforcer-Prod:JIRA_TOKEN@9::JIRA_TOKEN - workloads/prod/software_infra::secrets:SDLC-Enforcer-Prod:JIRA_USERNAME@9::JIRA_USERNAME - - name: Checkout uses: actions/checkout@v3 - name: Combine Product Specs uses: Bandwidth/api-specs-combine-action@v1.0.0 with: - token: ${{ env.DX_GITHUB_TOKEN }} + token: ${{ secrets.DX_GITHUB_TOKEN }} - name: Determine if a New SDK is Needed id: compare @@ -55,7 +44,7 @@ jobs: "name": "Story" }, "customfield_12108": "$LANGUAGE SDK is ready for release. Tests are created/updated if need be.", - "customfield_10205": "SWI-1876", + "customfield_10205": "$EPIC", "components": [{ "name": "Client SDKs" }] @@ -66,6 +55,9 @@ jobs: echo "jira-key=$JIRA_KEY" >> $GITHUB_OUTPUT env: LANGUAGE: Ruby + EPIC: SWI-1876 + JIRA_USERNAME: ${{ secrets.JIRA_USERNAME }} + JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }} - name: Build SDK id: build @@ -73,7 +65,7 @@ jobs: uses: Bandwidth/generate-sdk-action@v3.0.0 with: branch-name: ${{ steps.jira.outputs.jira-key }} - token: ${{ env.DX_GITHUB_TOKEN }} + token: ${{ secrets.DX_GITHUB_TOKEN }} openapi-generator-version: 7.0.0 language: ruby config: ./openapi-config.yml @@ -100,4 +92,17 @@ jobs: run: | gh pr create -B main -H Bandwidth:${{ steps.jira.outputs.jira-key }} -t '${{ steps.jira.outputs.jira-key }} Update SDK Based on Recent Spec Changes' -b 'Auto-generated by Update SDK Workflow' env: - GITHUB_TOKEN: ${{ env.DX_GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.DX_GITHUB_TOKEN }} + + notify-for-failures: + name: Notify for Failures + needs: [update-sdk] + if: failure() + runs-on: ubuntu-latest + steps: + - name: Notify Slack of Failures + uses: Bandwidth/build-notify-slack-action@v1.0.0 + with: + job-status: failure + slack-bot-token: ${{ secrets.SLACK_BOT_TOKEN }} + slack-channel: ${{ secrets.SLACK_CHANNEL }} diff --git a/README.md b/README.md index a0fa1b38..36980169 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,9 @@ Bandwidth - the Ruby gem for the Bandwidth +# Generated with the command: +`openapi-generator generate -g ruby -i bandwidth.yml -c openapi-config.yml -o ./` + Bandwidth's Communication APIs This SDK is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: diff --git a/custom_templates/README.mustache b/custom_templates/README.mustache index 85e5b50b..9ca7a51d 100644 --- a/custom_templates/README.mustache +++ b/custom_templates/README.mustache @@ -14,6 +14,9 @@ {{moduleName}} - the Ruby gem for the {{appName}} +# Generated with the command: +`openapi-generator generate -g ruby -i bandwidth.yml -c openapi-config.yml -o ./` + {{#appDescriptionWithNewLines}} {{{.}}} {{/appDescriptionWithNewLines}} diff --git a/custom_templates/version.mustache b/custom_templates/version.mustache deleted file mode 100644 index ae35b81c..00000000 --- a/custom_templates/version.mustache +++ /dev/null @@ -1,7 +0,0 @@ -=begin -{{> api_info}} -=end - -module {{moduleName}} - VERSION = ENV.fetch("GEM_VERSION") -end diff --git a/lib/bandwidth-sdk/version.rb b/lib/bandwidth-sdk/version.rb index 3d49c72a..baeb051c 100644 --- a/lib/bandwidth-sdk/version.rb +++ b/lib/bandwidth-sdk/version.rb @@ -11,5 +11,5 @@ =end module Bandwidth - VERSION = ENV.fetch('GEM_VERSION') + VERSION = '11.0.0' end diff --git a/spec/integration/calls_api_integration_spec.rb b/spec/integration/calls_api_integration_spec.rb index 3c870ad3..0f584882 100644 --- a/spec/integration/calls_api_integration_spec.rb +++ b/spec/integration/calls_api_integration_spec.rb @@ -93,7 +93,7 @@ expect(data.call_id).to eq($call_info_id) expect(data.account_id).to eq(BW_ACCOUNT_ID) expect(data.application_id).to eq(BW_VOICE_APPLICATION_ID) - expect(data.start_time).to be_instance_of(Time) + expect(data.start_time).to be_instance_of(Time).or be_nil expect(data.last_update).to be_instance_of(Time) expect(data.state).to be_instance_of(String) expect(data.direction).to eq(direction)