diff --git a/.github/workflows/build-balena-disk-image.yaml b/.github/workflows/build-balena-disk-image.yaml index 410835904..a98b80ade 100644 --- a/.github/workflows/build-balena-disk-image.yaml +++ b/.github/workflows/build-balena-disk-image.yaml @@ -13,6 +13,12 @@ on: default: 'master' jobs: + generate-openapi-schema: + uses: ./.github/workflows/generate-openapi-schema.yml + with: + release: true + tag: ${{ inputs.tag }} + commit: ${{ inputs.commit }} balena-build-images: strategy: matrix: diff --git a/.github/workflows/generate-openapi-schema.yml b/.github/workflows/generate-openapi-schema.yml index 0c7939f5e..d4952c5aa 100644 --- a/.github/workflows/generate-openapi-schema.yml +++ b/.github/workflows/generate-openapi-schema.yml @@ -33,6 +33,22 @@ on: - '!bin/install.sh' - '!bin/upgrade_containers.sh' - '!tests/**' + workflow_call: + inputs: + release: + description: 'Upload the OpenAPI schema as a release artifact' + required: true + type: boolean + default: false + tag: + description: 'Tag to be used for the release' + required: true + type: string + commit: + description: 'Commit or branch name' + required: false + type: string + default: 'master' jobs: generate-openapi-schema: @@ -92,3 +108,14 @@ jobs: with: name: anthias-api-schema path: anthias-api-schema.json + + - name: Upload the OpenAPI Schema as a release artifact + if: ${{ github.event_name == 'workflow_call' && inputs.release == true }} + uses: ncipollo/release-action@v1.11.2 + with: + allowUpdates: true + prerelease: true + artifacts: anthias-api-schema.json + tag: ${{ inputs.tag }} + commit: ${{ inputs.commit }} +