diff --git a/.github/workflows/deploy-service.yml b/.github/workflows/deploy-service.yml index 98ea53d..8463dda 100644 --- a/.github/workflows/deploy-service.yml +++ b/.github/workflows/deploy-service.yml @@ -2,6 +2,17 @@ name: Service Deploy run-name: 'Service Deploy [service: ${{ inputs.service }}, env: ${{ inputs.env }}]' on: + workflow_call: + inputs: + service: + required: true + type: string + env: + required: true + type: string + batch_run: + required: true + type: boolean workflow_dispatch: inputs: service: @@ -53,13 +64,18 @@ jobs: id: AWS uses: aws-actions/amazon-ecr-login@v1 + - name: Build base image + id: build-base-image + if: ${{ inputs.batch_run }} + run: | + : # Don't build the base image with NODE_ENV because it'll limit the packages that are installed + docker build -t terramatch-microservices-base:nx-base . + - name: Build, tag, and push images to Amazon ECR id: build-images run: | echo "${{ vars.ENV }}" > .env echo "DB_PASSWORD=\"${{ secrets.DB_PASSWORD }}\"" >> .env - : # Don't build the base image with NODE_ENV because it'll limit the packages that are installed - docker build -t terramatch-microservices-base:nx-base . SERVICE_IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG docker build --build-arg NODE_ENV=production --build-arg BUILD_FLAG=--prod -f apps/${{ inputs.service }}/Dockerfile -t $SERVICE_IMAGE . docker push $SERVICE_IMAGE diff --git a/.github/workflows/deploy-services.yml b/.github/workflows/deploy-services.yml new file mode 100644 index 0000000..33b3ba0 --- /dev/null +++ b/.github/workflows/deploy-services.yml @@ -0,0 +1,43 @@ +name: Services Deploy (all) +run-name: 'Services Deploy (all) [env: ${{ inputs.env }}]' + +on: + workflow_dispatch: + inputs: + env: + description: 'Deployment target environment' + type: choice + required: true + options: + - dev + - test + - staging + - prod + +permissions: + id-token: write + contents: read + +jobs: + build-base-image: + runs-on: ubuntu-latest + environment: ${{ inputs.env }} + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Build base image + id: build-base-image + run: | + : # Don't build the base image with NODE_ENV because it'll limit the packages that are installed + docker build -t terramatch-microservices-base:nx-base . + + job-service: + uses: wri/terramatch-microservices/.github/workflows/deploy-service.yml@task/TM-1448-unified-deployment + with: + env: ${{ inputs.env }} + service: job-service + batch_run: true + secrets: inherit + +