Skip to content

generate_publish_release #21

generate_publish_release

generate_publish_release #21

name: Generate Publish Release
on:
repository_dispatch:
types: [generate_publish_release]
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.client_payload.version }})"
- 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 python \
-c ./openapi/config.yml \
-t ./openapi/templates
- name: Checkout master
run: git checkout master
- name: Create commit
run: |
git config user.name "devexperience"
git config user.email "[email protected]"
git add .
git commit -m "Generated version ${{ steps.bump_version.outputs.version }}
This commit was automatically created by a GitHub Action to generate version ${{ steps.bump_version.outputs.version }} of this library."
- name: Push to master
run: git push origin master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Generate access token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.PAPI_SDK_APP_ID }}
installation_id: ${{ secrets.PAPI_SDK_INSTALLATION_ID }}
private_key: ${{ secrets.PAPI_SDK_PRIVATE_KEY }}
- name: Publish
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ steps.generate_token.outputs.token }}
event-type: publish_sdk
- name: Release
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ steps.generate_token.outputs.token }}
event-type: release_sdk
- 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 }}