From 10b79f5719962316c14d9a7c1488c232b2741b0f Mon Sep 17 00:00:00 2001 From: David Beaumont Date: Mon, 15 Jun 2020 10:56:29 +0100 Subject: [PATCH] (fix): Ensure wget is available in action (#6) --- CHANGELOG.md | 1 + README.md | 6 +++--- generate-client.sh | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f555f4b..ae2d78b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,4 @@ +* v0.0.5 - Explicitly install wget before attempting to download openapi generator jar * v0.0.4 - Diff new package with old package and only publish if there are changes * v0.0.3 - Use openapi-generator-cli@4.3.0 to fix ISO-8601 types previous generated as JavaScript Date objects. * v0.0.2 - Use openapi-generator-cli@4.2.3; error handling in main script. diff --git a/README.md b/README.md index 1b4e1d6..4b53d46 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Hatch is a GitHub Action that uses [openapi-generator](https://github.com/OpenAPITools/openapi-generator) to automatically generate and publish a TypeScript-axios API client for your service, based on your service's OpenAPI spec. ### Usage -To use this Action, you will need: +To use this Action, you will need: * An OpenAPI v3 spec of your service, which is accessible to the Action. Easiest might be to expose an endpoint that serves your service's OpenAPI spec * A GitHub NPM registry and an access token to publish packages to it @@ -17,7 +17,7 @@ generate-api-client: runs-on: ubuntu-latest steps: - name: Run Hatch Action - uses: birdiecare/hatch@v0.0.1 # <-- use current version + uses: birdiecare/hatch@v0.0.5 # <-- use current version with: path: name: # the generated client will automatically be called my-service-client @@ -27,6 +27,6 @@ generate-api-client: Running this Action will publish an NPM package called `my-service-client` as a package __inside the repository of the service running the Action__. ### Templating -[openapi-generator](https://github.com/OpenAPITools/openapi-generator) works by running a specified [code generator](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators.md) on an OpenAPI spec. Hatch uses [typescript-axios](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/typescript-axios.md) for this. +[openapi-generator](https://github.com/OpenAPITools/openapi-generator) works by running a specified [code generator](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators.md) on an OpenAPI spec. Hatch uses [typescript-axios](https://github.com/OpenAPITools/openapi-generator/blob/master/docs/generators/typescript-axios.md) for this. The code generator generates an API client based on the OpenAPI spec using [Mustache](https://mustache.github.io) templates. These templates are shipped with the relevant code generator. The `/templates/openapi-generator/typescript-axios` folder of this repo houses the templates used by this Action. They are unchanged from the standard templates used by `typescript-axios`, but are included so that it is easy to make changes if your use case requires them. diff --git a/generate-client.sh b/generate-client.sh index e24d6ee..ae6a99d 100755 --- a/generate-client.sh +++ b/generate-client.sh @@ -8,7 +8,7 @@ echo "Hatch action started." echo "Downloading and installing prerequisites..." apt-get update -apt-get -y install jq +apt-get -y install wget jq wget --quiet https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/4.3.0/openapi-generator-cli-4.3.0.jar -O openapi-generator-cli.jar if [ $? -ne 0 ] then @@ -83,7 +83,7 @@ elif [ $? -ne 1 ] then echo "ERROR: something went wrong comparing old to new package, aborting build." exit 1 -fi +fi echo "Differences found between old and new package. Publishing new package..." # copy package.json to dist folder and publish to GitHub package registry