From 1b09fad1b8d612d7b3b2e6d23196c275e6d45502 Mon Sep 17 00:00:00 2001 From: Artyom <33422161+WooDeNDark@users.noreply.github.com> Date: Tue, 17 Jan 2023 14:57:54 +0300 Subject: [PATCH 1/6] Add IMAGE_TAG to .env file --- .github/workflows/ui-workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ui-workflow.yml b/.github/workflows/ui-workflow.yml index 27ee877..e00896f 100644 --- a/.github/workflows/ui-workflow.yml +++ b/.github/workflows/ui-workflow.yml @@ -48,6 +48,8 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.SECRET_GH_TOKEN_CAN_READ_PACKAGES }} + - run: echo IMAGE_TAG=${{ secrets.SECRET_IMAGE_TAG }} >> .env + - run: npm run build if: ${{ inputs.IS_BUILD_ENABLED }} From 30d30745cfcdfd3fbc777bddca2cf25c3bd5943c Mon Sep 17 00:00:00 2001 From: Artyom <33422161+WooDeNDark@users.noreply.github.com> Date: Tue, 17 Jan 2023 15:01:04 +0300 Subject: [PATCH 2/6] Fix naming --- .github/workflows/ui-workflow.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ui-workflow.yml b/.github/workflows/ui-workflow.yml index e00896f..e3cd026 100644 --- a/.github/workflows/ui-workflow.yml +++ b/.github/workflows/ui-workflow.yml @@ -43,14 +43,17 @@ jobs: node-version: ${{ inputs.NODE_VERSION }} registry-url: 'https://npm.pkg.github.com' scope: '@arbinahq' + + - name: Add envs + run: echo IMAGE_TAG=${{ secrets.SECRET_IMAGE_TAG }} >> .env - - run: (rm .npmrc || true) && npm install + - name: NPM install packages + run: (rm .npmrc || true) && npm install env: NODE_AUTH_TOKEN: ${{ secrets.SECRET_GH_TOKEN_CAN_READ_PACKAGES }} - - - run: echo IMAGE_TAG=${{ secrets.SECRET_IMAGE_TAG }} >> .env - - - run: npm run build + + - name: NPM build + run: npm run build if: ${{ inputs.IS_BUILD_ENABLED }} - name: Login to ECR From 41c48fce311a43f8b4184e1fd43844aa2f79900e Mon Sep 17 00:00:00 2001 From: Artyom <33422161+WooDeNDark@users.noreply.github.com> Date: Tue, 17 Jan 2023 15:06:57 +0300 Subject: [PATCH 3/6] Fix IMAGE_TAG->VITE_GIT_COMMIT --- .github/workflows/ui-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ui-workflow.yml b/.github/workflows/ui-workflow.yml index e3cd026..f7d71ca 100644 --- a/.github/workflows/ui-workflow.yml +++ b/.github/workflows/ui-workflow.yml @@ -45,7 +45,7 @@ jobs: scope: '@arbinahq' - name: Add envs - run: echo IMAGE_TAG=${{ secrets.SECRET_IMAGE_TAG }} >> .env + run: echo VITE_GIT_COMMIT=${{ secrets.SECRET_IMAGE_TAG }} >> .env - name: NPM install packages run: (rm .npmrc || true) && npm install From 7229b8a7f1afae74e50e4eb92997ecf4c63c31fe Mon Sep 17 00:00:00 2001 From: Artyom <33422161+WooDeNDark@users.noreply.github.com> Date: Tue, 17 Jan 2023 15:18:00 +0300 Subject: [PATCH 4/6] Add env --- .github/workflows/ui-workflow.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ui-workflow.yml b/.github/workflows/ui-workflow.yml index f7d71ca..362862e 100644 --- a/.github/workflows/ui-workflow.yml +++ b/.github/workflows/ui-workflow.yml @@ -7,6 +7,11 @@ on: description: "Docker repository address" required: true type: string + GIT_REVISION_ENV_NAME: + description: "Env name for setting git revision" + required: false + type: string + default: 'REACT_GIT_REVISION' IS_ECR_PUSH_ENABLED: description: "Disable pushing to ECR. Default is true." required: true @@ -45,7 +50,7 @@ jobs: scope: '@arbinahq' - name: Add envs - run: echo VITE_GIT_COMMIT=${{ secrets.SECRET_IMAGE_TAG }} >> .env + run: echo ${{ inputs.GIT_REVISION_ENV_NAME }}=${{ secrets.SECRET_IMAGE_TAG }} >> .env - name: NPM install packages run: (rm .npmrc || true) && npm install From d814d06207cabfffd372d674f9696e556eca8ca4 Mon Sep 17 00:00:00 2001 From: Artyom <33422161+WooDeNDark@users.noreply.github.com> Date: Tue, 17 Jan 2023 15:30:48 +0300 Subject: [PATCH 5/6] debug --- .github/workflows/ui-workflow.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ui-workflow.yml b/.github/workflows/ui-workflow.yml index 362862e..acd77a2 100644 --- a/.github/workflows/ui-workflow.yml +++ b/.github/workflows/ui-workflow.yml @@ -50,7 +50,9 @@ jobs: scope: '@arbinahq' - name: Add envs - run: echo ${{ inputs.GIT_REVISION_ENV_NAME }}=${{ secrets.SECRET_IMAGE_TAG }} >> .env + run: | + echo ${{ inputs.GIT_REVISION_ENV_NAME }}=${{ secrets.SECRET_IMAGE_TAG }} >> .env + cat .env - name: NPM install packages run: (rm .npmrc || true) && npm install From c6144c396026666b82adf52b18a94a783192cf4f Mon Sep 17 00:00:00 2001 From: Artyom <33422161+WooDeNDark@users.noreply.github.com> Date: Mon, 13 Mar 2023 13:32:27 +0300 Subject: [PATCH 6/6] Update ui-workflow.yml Add IMAGE_TAG_ECR --- .github/workflows/ui-workflow.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ui-workflow.yml b/.github/workflows/ui-workflow.yml index acd77a2..d6764c7 100644 --- a/.github/workflows/ui-workflow.yml +++ b/.github/workflows/ui-workflow.yml @@ -21,6 +21,11 @@ on: required: false type: boolean default: true + IMAGE_TAG_ECR: + description: "Select image tag for ECR" + required: false + type: string + default: latest NODE_VERSION: description: "Node version to setup. Default is 16." required: false @@ -79,11 +84,12 @@ jobs: ECR_REPOSITORY: ${{ inputs.ECR_REPOSITORY }} IMAGE_TAG: ${{ secrets.SECRET_IMAGE_TAG }} BOOT_JAR_NAME: ${{ inputs.BOOT_JAR_NAME }} + IMAGE_TAG_ECR: ${{ inputs.IMAGE_TAG_ECR }} run: | docker build --build-arg=IMAGE_TAG=$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG - docker build --build-arg=IMAGE_TAG=$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest . - docker push $ECR_REGISTRY/$ECR_REPOSITORY:latest + docker build --build-arg=IMAGE_TAG=$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_ECR . + docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG_ECR - name: Logout on Arbina ECR run: docker logout ${{ secrets.SECRET_ECR_REGISTRY }}