Generate #32
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
name: Generate | |
on: | |
workflow_dispatch: | |
inputs: | |
version_level: | |
description: "Bump version" | |
required: true | |
default: "patch" | |
type: choice | |
options: | |
- major | |
- minor | |
- patch | |
jobs: | |
Generate: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.1 | |
- name: Bump version | |
id: bump_version | |
run: echo "::set-output name=version::$(ruby .github/version.rb ${{ github.event.inputs.version_level }})" | |
- name: Clean repo | |
run: ruby .github/clean.rb | |
- name: Install openapi-generator-cli | |
run: | | |
npm install @openapitools/openapi-generator-cli -g | |
- run: | | |
openapi-generator-cli generate \ | |
-i https://raw.githubusercontent.com/mxenabled/openapi/master/openapi/mx_platform_api.yml \ | |
-g java \ | |
-c ./openapi/config.yml \ | |
-t ./openapi/templates | |
- name: Create branch | |
run: git checkout -b "openapi-generator-${{ steps.bump_version.outputs.version }}" | |
- name: Create commit | |
run: | | |
git config user.name "devexperience" | |
git config user.email "devexperience@mx.com" | |
git add . | |
git commit -m "Generated version ${{ steps.bump_version.outputs.version }} | |
This pull request was automatically generated by a GitHub Action to generate version ${{ steps.bump_version.outputs.version }} of this library." | |
git push -u origin "openapi-generator-${{ steps.bump_version.outputs.version }}" | |
- name: Create PR | |
run: gh pr create -f | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Slack notification | |
uses: ravsamhq/notify-slack-action@v2 | |
if: always() | |
with: | |
status: ${{ job.status }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
notification_title: "{repo}: {workflow} workflow" | |
message_format: "{emoji} *{workflow}* {status_message} in <{repo_url}|{repo}>" | |
footer: "<{workflow_url}|View Workflow>" | |
notify_when: "failure" | |
env: | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |