Skip to content

Commit

Permalink
[TM-1448] Try triggering job service build from new action
Browse files Browse the repository at this point in the history
  • Loading branch information
roguenet committed Nov 12, 2024
1 parent 35d9220 commit 4b6be52
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 2 deletions.
20 changes: 18 additions & 2 deletions .github/workflows/deploy-service.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
43 changes: 43 additions & 0 deletions .github/workflows/deploy-services.yml
Original file line number Diff line number Diff line change
@@ -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


0 comments on commit 4b6be52

Please sign in to comment.