From 51f89f9761cd2adb925223a291371b2a72281d16 Mon Sep 17 00:00:00 2001 From: andyjmaclean Date: Thu, 11 Apr 2024 19:52:22 +0200 Subject: [PATCH] MET-5919 Introduce Github Workflows --- .github/workflows/_deploy-metis.js.yaml | 5 ++++- .github/workflows/_deploy-sandbox.js.yaml | 5 ++++- .github/workflows/deploy-image.yaml | 23 ++++++++++++++++------- 3 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.github/workflows/_deploy-metis.js.yaml b/.github/workflows/_deploy-metis.js.yaml index 66c473616..31be9065b 100644 --- a/.github/workflows/_deploy-metis.js.yaml +++ b/.github/workflows/_deploy-metis.js.yaml @@ -66,7 +66,7 @@ jobs: with: node-version: '18.18.0' - run: npm install - - run: npm build-shared + - run: npm run build-shared - run: npm run dist-metis - uses: actions/upload-artifact@master with: @@ -139,4 +139,7 @@ jobs: && !cancelled() needs: [push-docker-image, make-env-file] uses: ./.github/workflows/deploy-image.yaml + with: + image_name: metis-ui + project_dir: metis secrets: inherit diff --git a/.github/workflows/_deploy-sandbox.js.yaml b/.github/workflows/_deploy-sandbox.js.yaml index 4f179b109..8a9a217e4 100644 --- a/.github/workflows/_deploy-sandbox.js.yaml +++ b/.github/workflows/_deploy-sandbox.js.yaml @@ -66,7 +66,7 @@ jobs: with: node-version: '18.18.0' - run: npm install - - run: npm build-shared + - run: npm run build-shared - run: npm run dist-sandbox - uses: actions/upload-artifact@master with: @@ -140,4 +140,7 @@ jobs: && !cancelled() needs: [push-docker-image, make-env-file-sandbox] uses: ./.github/workflows/deploy-image.yaml + with: + image_name: sandbox-ui + project_dir: sandbox secrets: inherit diff --git a/.github/workflows/deploy-image.yaml b/.github/workflows/deploy-image.yaml index 5f154680a..d200d7c2b 100644 --- a/.github/workflows/deploy-image.yaml +++ b/.github/workflows/deploy-image.yaml @@ -1,5 +1,17 @@ name: '- helper (image deployment)' -on: workflow_call +on: + workflow_call: + inputs: + image_name: + description: 'docker image name (metis-ui or sandbox-ui)' + required: true + default: 'metis-ui' + type: string + project_dir: + description: 'project directory' + required: true + default: 'metis' + type: string jobs: deploy-image: runs-on: ubuntu-latest @@ -12,23 +24,20 @@ jobs: with: name: envFile path: env_file - - run: | - mv env_file/env_file deployment/${{ github.event.inputs.deploy_environment }} - + mv env_file/env_file ${{ github.event.inputs.project_dir }}/deployment/${{ github.event.inputs.deploy_environment }} - run: | tag=${{ github.event.inputs.tag_name || 'develop' }} TAG_ESCAPED=${tag//[\/]/_} echo TAG_ESCAPED=${TAG_ESCAPED} >> $GITHUB_ENV - - name: Inject Variables 1 uses: cschleiden/replace-tokens@v1 with: tokenPrefix: '#{' tokenSuffix: '}#' - files: '["deployment/${{ github.event.inputs.deploy_environment }}/*.yaml"]' + files: '["${{ github.event.inputs.project_dir }}/deployment/${{ github.event.inputs.deploy_environment }}/*.yaml"]' env: - APP_IMAGE: europeana/statistics-dashboard:${{ env.TAG_ESCAPED }} + APP_IMAGE: europeana/${{ github.event.inputs.image_name }}:${{ env.TAG_ESCAPED }} MAX_REPLICAS: '4' MIN_REPLICAS: '2' UTILISATION_AVERAGE_PERCENT: '75'