microplan roleAccess (#1580) #405
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Digit Admin Console Build workflow | |
on: | |
push: | |
branches: [ 'develop','console','master'] | |
paths: | |
- 'health/micro-ui/web/micro-ui-internals/**' | |
workflow_dispatch: | |
jobs: | |
docker_image-build: | |
outputs: | |
run_job_digit_ui: ${{ steps.check_files.outputs.run_job_digit_ui }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 2 | |
- name: Setup Docker | |
uses: docker/setup-buildx-action@v1 | |
- name: check modified files | |
id: check_files | |
run: | | |
echo "=============== list modified files ===============" | |
git diff --name-only HEAD^ HEAD | |
echo "========== check paths of modified files ==========" | |
git diff --name-only HEAD^ HEAD > files.txt | |
run_job_digit_ui=false | |
while IFS= read -r file | |
do | |
if [[ $file == health/micro-ui/* ]]; then | |
echo "This modified file is under the 'digit_ui' folder." | |
run_job_digit_ui=true | |
fi | |
done < files.txt | |
# Set the output based on whether the job should run | |
echo "::set-output name=run_job_digit_ui::$run_job_digit_ui" | |
echo "ACTION_NUMBER=${GITHUB_RUN_NUMBER}" >> $GITHUB_ENV | |
echo "COMMIT_ID=${GITHUB_SHA: -8}" >> $GITHUB_ENV # Extract last 8 characters of SHA | |
echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
- name: Login to egovio docker Container Registry | |
env: | |
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | |
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | |
run: | | |
# Authenticate with Docker Hub | |
echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin | |
- name: Build and Push Docker images for digit-ui | |
if: ${{ steps.check_files.outputs.run_job_digit_ui == 'true' }} | |
run: | | |
# workbench ui Docker build | |
IMAGE_NAME_1=workbench-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} | |
docker build -t $IMAGE_NAME_1 -f web/workbench/Dockerfile . | |
docker tag $IMAGE_NAME_1 egovio/$IMAGE_NAME_1 | |
docker push egovio/$IMAGE_NAME_1 | |
# Print success message for the first image | |
echo "Docker image 1 built and pushed successfully: egovio/$IMAGE_NAME_1" | |
# microplan ui Docker build | |
IMAGE_NAME_2=microplan-ui:${{ env.BRANCH_NAME }}-${{ env.COMMIT_ID }}-${{ env.ACTION_NUMBER }} | |
docker build -t $IMAGE_NAME_2 -f web/microplan/Dockerfile . | |
docker tag $IMAGE_NAME_2 egovio/$IMAGE_NAME_2 | |
docker push egovio/$IMAGE_NAME_2 | |
# Print success message for the second image | |
echo "Docker image 2 built and pushed successfully: egovio/$IMAGE_NAME_2" | |
working-directory: health/micro-ui | |