Skip to content

generate-publish-client #165

generate-publish-client

generate-publish-client #165

Workflow file for this run

name: Build Ruby SDK
on:
repository_dispatch:
types: [generate-publish-client]
permissions:
contents: write
jobs:
generate-and-publish-client:
runs-on: ubuntu-latest
env:
GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Swagger YAML
run: |
curl -sSLo swagger.yaml https://raw.githubusercontent.com/pijng/moonlogs/master/internal/api/swagger.yaml
- name: Download Swagger Codegen
run: |
wget https://repo1.maven.org/maven2/io/swagger/codegen/v3/swagger-codegen-cli/3.0.52/swagger-codegen-cli-3.0.52.jar -O swagger-codegen-cli.jar
- name: Install Java
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '11'
- name: Build Ruby SdK
run: |
java -jar swagger-codegen-cli.jar generate -i swagger.yaml -l ruby -o moonlogs-ruby --additional-properties gemName=moonlogs-ruby gemVersion=${{ github.event.client_payload.tag_version }}
rm swagger-codegen-cli.jar
rm swagger.yaml
- name: Commit & Push changes
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true
branch: master
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7
- name: Build and publish Gem
run: |
cd moonlogs-ruby
gem build moonlogs-ruby.gemspec
gem push moonlogs-ruby-${{ github.event.client_payload.tag_version }}.gem