From dae99a6ee564910164a582f9f0352c3a9d61238e Mon Sep 17 00:00:00 2001 From: Michael Chin Date: Wed, 1 Mar 2023 20:16:36 -0800 Subject: [PATCH 1/3] Add manual trigger for ECR updates --- .github/workflows/build_docker.yml | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index ac356164f..9a8da7dee 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -1,6 +1,13 @@ name: Build Docker image and publish to ECR on: + workflow_dispatch: + inputs: + image_tag: + description: 'Docker image tag' + required: false + type: string + default: 'latest' push: branches: - main @@ -16,6 +23,15 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Get image tag + id: get-image-tag + run: | + if ${{ github.event_name == 'workflow_dispatch' }} ; then + echo "image_tag=${{ inputs.image_tag }}" >> $GITHUB_OUTPUT + else + echo "image_tag=latest" >> $GITHUB_OUTPUT + fi + - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 with: @@ -37,7 +53,7 @@ jobs: REGISTRY: ${{ steps.login-ecr-public.outputs.registry }} REGISTRY_ALIAS: neptune REPOSITORY: graph-explorer - IMAGE_TAG: latest + IMAGE_TAG: ${{ steps.get-image-tag.outputs.image_tag }} run: | docker build -t $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG . docker push $REGISTRY/$REGISTRY_ALIAS/$REPOSITORY:$IMAGE_TAG From d0566d1b4308931721b620cc74bdc3eab59f4ef8 Mon Sep 17 00:00:00 2001 From: Michael Chin Date: Thu, 2 Mar 2023 17:58:46 -0800 Subject: [PATCH 2/3] Change from str input to release/latest selector --- .github/workflows/build_docker.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 9a8da7dee..7e7ba69c7 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -4,9 +4,12 @@ on: workflow_dispatch: inputs: image_tag: - description: 'Docker image tag' + description: 'ECR image tag type' required: false - type: string + type: choice + options: + - 'latest' + - 'release' default: 'latest' push: branches: @@ -23,14 +26,25 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Get package version + uses: tyankatsu0105/read-package-version-actions@v1 + with: + path: "./" + id: package-version + - name: Get image tag id: get-image-tag run: | if ${{ github.event_name == 'workflow_dispatch' }} ; then - echo "image_tag=${{ inputs.image_tag }}" >> $GITHUB_OUTPUT + if ${{ inputs.image_tag == 'release'}}; then + echo "image_tag=${{ steps.package-version.outputs.version }}" >> $GITHUB_OUTPUT + else + echo "image_tag=latest" >> $GITHUB_OUTPUT + fi else echo "image_tag=latest" >> $GITHUB_OUTPUT fi + echo "package version: ${{ steps.package-version.outputs.version }}" - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1 From e8f24f2c00f9f31b5ab24909c94769df3ebac7dd Mon Sep 17 00:00:00 2001 From: Michael Chin Date: Thu, 2 Mar 2023 18:00:17 -0800 Subject: [PATCH 3/3] remove debug --- .github/workflows/build_docker.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build_docker.yml b/.github/workflows/build_docker.yml index 7e7ba69c7..b8b6f154f 100644 --- a/.github/workflows/build_docker.yml +++ b/.github/workflows/build_docker.yml @@ -44,7 +44,6 @@ jobs: else echo "image_tag=latest" >> $GITHUB_OUTPUT fi - echo "package version: ${{ steps.package-version.outputs.version }}" - name: Configure AWS Credentials uses: aws-actions/configure-aws-credentials@v1