From 06b46676994a093953221470bd6dfc138a223bfa Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Tue, 17 Oct 2023 16:10:24 -0600 Subject: [PATCH 1/6] feat(go_app_release): use release version in Open API spec --- .github/workflows/go_app_release.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index 42bdbd1..734a244 100644 --- a/.github/workflows/go_app_release.yml +++ b/.github/workflows/go_app_release.yml @@ -119,6 +119,16 @@ jobs: - name: Setup Docker Buildx id: buildx uses: docker/setup-buildx-action@v2 + # Update the openapi file to use the release version + - name: Prep Open API file + uses: mikefarah/yq@master + if: ${{ env.APISPEC_PATH }} + with: + cmd: yq -i '.info.version=${{ steps.release.outputs.version }}' ${{ env.APISPEC_PATH }} + # Move openapi file to the correct location and override version + - name: Prep Open API file + if: ${{ env.APISPEC_PATH && env.APISPEC_BUILD_PATH}} + run: cat ${env.APISPEC_PATH} && cp ${env.APISPEC_PATH} ${env.APISPEC_BUILD_PATH} # Build and push the image. - name: Build and Push to Artifact Registry and Container Registry uses: docker/build-push-action@v3 From dc20149b7910bd23ff9d0fb4d4c99ecbb9d06383 Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Tue, 17 Oct 2023 16:27:37 -0600 Subject: [PATCH 2/6] chore(go_app_release): update step name for yq command --- .github/workflows/go_app_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index 734a244..741657e 100644 --- a/.github/workflows/go_app_release.yml +++ b/.github/workflows/go_app_release.yml @@ -120,7 +120,7 @@ jobs: id: buildx uses: docker/setup-buildx-action@v2 # Update the openapi file to use the release version - - name: Prep Open API file + - name: Add release version to Open API file uses: mikefarah/yq@master if: ${{ env.APISPEC_PATH }} with: From e0e5d9a1a59c4f5ce8c4cd1dbb0a41d49f4a3e7a Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Tue, 17 Oct 2023 16:35:37 -0600 Subject: [PATCH 3/6] chore(go_app_release): add APISPEC_PATH and APISPEC_BUILD_PATH to inputs --- .github/workflows/go_app_release.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index 741657e..5ded56c 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' From cec951a35affa9bc33c60bfad24ad51956357c0e Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Tue, 17 Oct 2023 16:38:32 -0600 Subject: [PATCH 4/6] chore(go_app_release): reference inputs object instead of env --- .github/workflows/go_app_release.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index 5ded56c..7caeeef 100644 --- a/.github/workflows/go_app_release.yml +++ b/.github/workflows/go_app_release.yml @@ -130,13 +130,13 @@ jobs: # Update the openapi file to use the release version - name: Add release version to Open API file uses: mikefarah/yq@master - if: ${{ env.APISPEC_PATH }} + if: ${{ inputs.APISPEC_PATH }} with: - cmd: yq -i '.info.version=${{ steps.release.outputs.version }}' ${{ env.APISPEC_PATH }} + cmd: yq -i '.info.version=${{ steps.release.outputs.version }}' ${{ inputs.APISPEC_PATH }} # Move openapi file to the correct location and override version - - name: Prep Open API file - if: ${{ env.APISPEC_PATH && env.APISPEC_BUILD_PATH}} - run: cat ${env.APISPEC_PATH} && cp ${env.APISPEC_PATH} ${env.APISPEC_BUILD_PATH} + - 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 From a84db7dcc7bfc0a19c239632536b9e01ff16b66f Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Tue, 17 Oct 2023 16:41:08 -0600 Subject: [PATCH 5/6] chore(go_app_release): alter yq expression --- .github/workflows/go_app_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index 7caeeef..1455253 100644 --- a/.github/workflows/go_app_release.yml +++ b/.github/workflows/go_app_release.yml @@ -132,7 +132,7 @@ jobs: uses: mikefarah/yq@master if: ${{ inputs.APISPEC_PATH }} with: - cmd: yq -i '.info.version=${{ steps.release.outputs.version }}' ${{ inputs.APISPEC_PATH }} + 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}} From c927ee6cfc41cde4d3d1ff72ac72ed235458b50e Mon Sep 17 00:00:00 2001 From: Nick Otter Date: Tue, 17 Oct 2023 16:43:30 -0600 Subject: [PATCH 6/6] chore(go_app_release): alter github action variable substitution --- .github/workflows/go_app_release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/go_app_release.yml b/.github/workflows/go_app_release.yml index 1455253..0ede544 100644 --- a/.github/workflows/go_app_release.yml +++ b/.github/workflows/go_app_release.yml @@ -136,7 +136,7 @@ jobs: # 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} + 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