|
| 1 | +name: Generate SDK |
| 2 | + |
| 3 | +on: |
| 4 | + repository_dispatch: |
| 5 | + types: [generate_sdk] |
| 6 | + |
| 7 | +jobs: |
| 8 | + Generate: |
| 9 | + runs-on: ubuntu-latest |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v3 |
| 12 | + - uses: actions/setup-node@v3 |
| 13 | + - uses: ruby/setup-ruby@v1 |
| 14 | + with: |
| 15 | + ruby-version: 3.1 |
| 16 | + - name: Bump version |
| 17 | + id: bump_version |
| 18 | + run: echo "::set-output name=version::$(ruby .github/version.rb ${{ github.event.client_payload.version }})" |
| 19 | + - name: Clean repo |
| 20 | + run: ruby .github/clean.rb |
| 21 | + - name: Install openapi-generator-cli |
| 22 | + run: | |
| 23 | + npm install @openapitools/openapi-generator-cli -g |
| 24 | + openapi-generator-cli version-manager set 5.4.0 |
| 25 | + - run: | |
| 26 | + openapi-generator-cli generate \ |
| 27 | + -i https://raw.githubusercontent.com/mxenabled/openapi/master/openapi/mx_platform_api.yml \ |
| 28 | + -g csharp-netcore \ |
| 29 | + -c ./openapi/config.yml \ |
| 30 | + -t ./openapi/templates |
| 31 | + - name: Checkout master |
| 32 | + run: git checkout master |
| 33 | + - name: Create commit |
| 34 | + run: | |
| 35 | + git config user.name "devexperience" |
| 36 | + git config user.email "[email protected]" |
| 37 | + git add . |
| 38 | + git commit -m "Generated version ${{ steps.bump_version.outputs.version }} |
| 39 | +
|
| 40 | + This commit was automatically created by a GitHub Action to generate version ${{ steps.bump_version.outputs.version }} of this library." |
| 41 | + - name: Push to master |
| 42 | + run: git push origin master |
| 43 | + env: |
| 44 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 45 | + - name: Slack notification |
| 46 | + uses: ravsamhq/notify-slack-action@v2 |
| 47 | + if: always() |
| 48 | + with: |
| 49 | + status: ${{ job.status }} |
| 50 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 51 | + notification_title: "{repo}: {workflow} workflow" |
| 52 | + message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" |
| 53 | + footer: "<{workflow_url}|View Workflow>" |
| 54 | + notify_when: "failure" |
| 55 | + env: |
| 56 | + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
0 commit comments