diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index 42bdbd1..0ede544 100644 --- a/.github/workflows/go_app_release.yml +++ b/.github/workflows/go_app_release.yml @@ -11,6 +11,14 @@ on: description: 'GOPRIVATE env for go commands' required: false type: string + APISPEC_PATH: + description: 'The path to an Open API spec. Will have info.version updated with the release version' + required: false + type: string + APISPEC_BUILD_PATH: + description: 'A location to copy the APISPEC_PATH file to' + required: false + type: string secrets: GH_CI_PAT: description: 'Token password for GitHub auth' @@ -119,6 +127,16 @@ jobs: - name: Setup Docker Buildx id: buildx uses: docker/setup-buildx-action@v2 + # Update the openapi file to use the release version + - name: Add release version to Open API file + uses: mikefarah/yq@master + if: ${{ inputs.APISPEC_PATH }} + with: + cmd: yq -i '.info.version="${{ steps.release.outputs.version }}"' ${{ inputs.APISPEC_PATH }} + # Move openapi file to the correct location and override version + - name: Copy Open API file + if: ${{ inputs.APISPEC_PATH && inputs.APISPEC_BUILD_PATH}} + run: cat ${{ inputs.APISPEC_PATH }} && cp ${{ inputs.APISPEC_PATH }} ${{ inputs.APISPEC_BUILD_PATH}} # Build and push the image. - name: Build and Push to Artifact Registry and Container Registry uses: docker/build-push-action@v3