diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index eb369e1..edc03b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,10 +15,29 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 + - name: Setup Java + if: matrix.os == 'windows-latest' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 21 + - name: Run action uses: ./ + - name: Get version + run: openapi-generator-cli version + - name: Run action with version uses: ./ with: - version: 2.3.4 + version: 7.9.0 + + - name: Check version + shell: bash + run: | + if [[ $(openapi-generator-cli version) != '7.9.0' ]]; then + echo 'Version does not match. See version below:' + openapi-generator-cli --version + exit 1 + fi diff --git a/README.md b/README.md index 4461339..9303b60 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ jobs: - name: Setup OpenAPI uses: remarkablemark/setup-openapi@v1 - - name: Generate Ruby client from spec + - name: Generate Ruby Client run: openapi-generator-cli generate -i petstore.yaml -g ruby -o /tmp/test/ ``` @@ -30,6 +30,12 @@ Install OpenAPI Generator CLI tool: - uses: remarkablemark/setup-openapi@v1 ``` +Generate a Ruby client from a valid [petstore.yaml](https://petstore3.swagger.io/) doc: + +```yaml +- run: openapi-generator-cli generate -i petstore.yaml -g ruby -o /tmp/test/ +``` + See [action.yml](action.yml) ## Inputs diff --git a/action.yml b/action.yml index 54208e2..38be09a 100644 --- a/action.yml +++ b/action.yml @@ -10,10 +10,14 @@ inputs: runs: using: composite steps: - - name: Print version - shell: bash - run: | - echo "version: $VERSION" + - name: Install OpenAPI Generator CLI + shell: sh + run: npm install --global @openapitools/openapi-generator-cli + + - name: Set OpenAPI Generator Version + if: inputs.version + shell: sh + run: openapi-generator-cli version-manager set $VERSION env: VERSION: ${{ inputs.version }}