Skip to content

Commit 287847e

Browse files
committed
Simplify generate sdk workflow
Our `publish` and `release` workflows run when we `push` to `master` so we can remove the `publish` and `release` jobs from our repository dispatch `generate_sdk` workflow. This should also fix any issues we are seeing where we are trying to publish or release using the wrong version. The old version seems to have been cached during the old flow which caused the workflow to fail.
1 parent b69e214 commit 287847e

2 files changed

Lines changed: 56 additions & 121 deletions

File tree

.github/workflows/generate_publish_release.yml

Lines changed: 0 additions & 121 deletions
This file was deleted.

.github/workflows/generate_sdk.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
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 ruby \
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 "devexperience@mx.com"
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

Comments
 (0)