File tree Expand file tree Collapse file tree 6 files changed +92
-5
lines changed
Expand file tree Collapse file tree 6 files changed +92
-5
lines changed Original file line number Diff line number Diff line change 1+ require "fileutils"
2+
3+ ALLOW_LIST = [
4+ ".git" ,
5+ ".github" ,
6+ ".gitignore" ,
7+ ".openapi-generator-ignore" ,
8+ "LICENSE" ,
9+ "openapi"
10+ ] . freeze
11+
12+ ::Dir . each_child ( ::Dir . pwd ) do |source |
13+ next if ALLOW_LIST . include? ( source )
14+
15+ ::FileUtils . rm_rf ( "#{ ::Dir . pwd } /#{ source } " )
16+ end
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+ require "yaml"
2+ config = ::YAML . load ( ::File . read ( "openapi/config.yml" ) )
3+ major , minor , patch = config [ "gemVersion" ] . split ( "." )
4+
5+ case ARGV [ 0 ]
6+ when "major"
7+ major = major . succ
8+ minor = 0
9+ patch = 0
10+ when "minor"
11+ minor = minor . succ
12+ patch = 0
13+ when "patch"
14+ patch = patch . succ
15+ end
16+
17+ config [ "gemVersion" ] = "#{ major } .#{ minor } .#{ patch } "
18+ ::File . open ( "openapi/config.yml" , 'w' ) { |file | ::YAML . dump ( config , file ) }
19+ puts config [ "gemVersion" ]
Original file line number Diff line number Diff line change 1+ name : Generate
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ version_level :
7+ description : " Bump version"
8+ required : true
9+ default : " patch"
10+ type : choice
11+ options :
12+ - major
13+ - minor
14+ - patch
15+
16+ jobs :
17+ Generate :
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v2
21+ - name : Set up Ruby
22+ uses : ruby/setup-ruby@v1
23+ with :
24+ bundler-cache : true
25+ ruby-version : 3.1
26+ - name : Bump version
27+ id : bump_version
28+ run : echo "::set-output name=version::$(ruby .github/version.rb ${{ github.event.inputs.version_level }})"
29+ - name : Clean repo
30+ run : ruby .github/clean.rb
31+ - uses : actions/setup-node@v2
32+ - run : |
33+ npm install @openapitools/openapi-generator-cli -g
34+ openapi-generator-cli version
35+ - run : |
36+ openapi-generator-cli generate \
37+ -i https://raw.githubusercontent.com/mxenabled/openapi/master/openapi/mx_platform_api_beta.yml \
38+ -g ruby \
39+ -c ./openapi/config.yml \
40+ -t ./openapi/templates
41+ - name : Create branch
42+ run : git checkout -b "openapi-generator-${{ steps.bump_version.outputs.version }}"
43+ - name : Create commit
44+ run : |
45+ git config user.name "devexperience"
46+ git config user.email "devexperience@mx.com"
47+ git add .
48+ git commit -m "Generated version ${{ steps.bump_version.outputs.version }}
49+
50+ This pull request was automatically generated by a GitHub Action to generate version ${{ steps.bump_version.outputs.version }} of this library."
51+ git push -u origin "openapi-generator-${{ steps.bump_version.outputs.version }}"
52+ - name : Create PR
53+ run : gh pr create -f
54+ env :
55+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
Original file line number Diff line number Diff line change 1616 ruby-version : 3.1
1717 - name : Read version
1818 id : read_version
19- run : echo "::set-output name=version::$(ruby .github/read_version .rb)"
19+ run : echo "::set-output name=version::$(ruby .github/version .rb)"
2020 - name : Create tag and release
2121 run : |
2222 gh release create "v${{ steps.read_version.outputs.version }}"
Original file line number Diff line number Diff line change @@ -6,6 +6,6 @@ gemHomepage: "https://github.com/mxenabled/mx-platform-ruby"
66gemLicense : " MIT"
77gemName : " mx-platform-ruby"
88gemRequiredRubyVersion : " >= 2.6"
9- gemVersion : " 0.8.1 "
9+ gemVersion : " 0.8.2 "
1010library : " faraday"
1111moduleName : " MxPlatformRuby"
You can’t perform that action at this time.
0 commit comments