diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 4146a76..3723315 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -57,15 +57,14 @@ jobs: - name: Re-generate isp run: ./run.sh - - name: Re-generate isp-slates + - name: Re-generate isp-slate run: ./run-slate.sh - name: Detect generated changes id: changes run: | - git add isp - git add isp-slate - git status -s + git add isp isp-slate + git status if [ -n "$(git status -s)" ]; then echo "should-commit=true" | tee -a "$GITHUB_OUTPUT" diff --git a/.gitignore b/.gitignore index e30282f..a9a57ac 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,5 @@ _testmain.go *.prof isp/api + +.DS_Store diff --git a/run-slate.sh b/run-slate.sh index d7a4dd2..c1af657 100755 --- a/run-slate.sh +++ b/run-slate.sh @@ -19,8 +19,18 @@ mkdir isp-slate cp ./prerequisites/.openapi-generator-ignore ./isp-slate/.openapi-generator-ignore cp ./prerequisites/convenience._go ./isp-slate/convenience.go cp ./prerequisites/slates_client._go ./isp-slate/client.go -docker build -t generate-sdk . --no-cache --build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" --build-arg OUT=isp-slate -docker run --rm -v ${SCRIPT_DIR}/isp-slate:/go-sdk/isp-slate generate-sdk + +# build sdk generation image +docker build -t generate-sdk . \ + --no-cache \ + --build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" \ + --build-arg OUT=isp-slate + +# generate sdk +docker run --rm \ + -u "$(id -u):$(id -g)" \ + -v ${SCRIPT_DIR}/isp-slate:/go-sdk/isp-slate \ + generate-sdk if [[ "$GITHUB_ACTIONS" = "true" ]]; then # Logicless templates are dumping extra quotes around enum values, so we've diff --git a/run.sh b/run.sh index ee3c60f..2d854ae 100755 --- a/run.sh +++ b/run.sh @@ -19,8 +19,18 @@ mkdir isp cp ./prerequisites/.openapi-generator-ignore ./isp/.openapi-generator-ignore cp ./prerequisites/convenience._go ./isp/convenience.go cp ./prerequisites/client._go ./isp/client.go -docker build -t generate-sdk . --no-cache --build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" --build-arg OUT=isp -docker run --rm -v ${SCRIPT_DIR}/isp:/go-sdk/isp generate-sdk + +# build sdk generation image +docker build -t generate-sdk . \ + --no-cache \ + --build-arg OPENAPI_SPEC="${OPENAPI_SPEC}" \ + --build-arg OUT=isp + +# generate sdk +docker run --rm \ + -u "$(id -u):$(id -g)" \ + -v ${SCRIPT_DIR}/isp:/go-sdk/isp \ + generate-sdk if [[ "$GITHUB_ACTIONS" = "true" ]]; then # Logicless templates are dumping extra quotes around enum values, so we've