From 483fab0cfbfdbedf7bda17b581e2c31f21616746 Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 12:21:06 -0400 Subject: [PATCH 01/10] update react cicd to use reusable workflow --- .github/labeler.yml | 6 +++--- .github/workflows/react-cicd.yml | 36 +++++++++++++------------------- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/labeler.yml b/.github/labeler.yml index e79c796..b3db52c 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -4,15 +4,15 @@ repo: # Add 'source' label to any change to files within the api or ui dir EXCEPT for the docs sub-folder source: -- any: ['api/**/*', 'ui/**/*', '!**/docs/*'] +- any: [ 'api/**/*', 'ui/**/*', '!**/docs/*' ] # Add 'backend` label to any change to .net files backend: -- any: ['api/**/*'] +- any: [ 'api/**/*' ] # Add 'frontend` label to any change to *.js files frontend: -- any: ['**/*.js', 'ui/**/*'] +- any: [ 'ui/**/*', '**/*.js' ] # Add 'test' label to any change to *.spec.js files within the source dir test: diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index 28d2b20..8958940 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -8,31 +8,23 @@ on: # Trigger manually workflow_dispatch: +env: + artifact-ui: ui + artifact-api: api + jobs: # Build React app - build: + build-ui: name: Build React app - uses: msfred/.github/.github/workflows/build-react.yml@main + uses: msfred/templates/.github/workflows/build-react.yml@main with: - project: MyReactApp - secrets: - token: ${{ secrets.token }} + artifact: ${{ env.artifact-ui }} - deploy: - name: Deploy to ${{ matrix.environment }} - runs-on: ubuntu-latest - environment: - name: ${{ matrix.environment }} - url: ${{ matrix.url }} - strategy: - matrix: - environment: ['development', 'production'] - include: - - environment: development - url: https://dev.hr-product.msfred.org - - environment: production - url: https://hr-product.msfred.com - steps: - - name: Debug step for the Depoly to ${{ matrix.environment }} job - run: echo "Starting the deploy to ${{ matrix.environment }}" + # Deploy React app + deploy-dev-ui: + name: Deploy to development + uses: msfred/templates/.github/workflows/deploy-webapp.yml@main + with: + artifact: ${{ env.artifact-ui }} + environment: development From b26139048b5bbe5e2593d16afbf9b4f6d7d67fb2 Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 12:23:49 -0400 Subject: [PATCH 02/10] add pr to workflow --- .github/workflows/react-cicd.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index 8958940..7c63a21 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -5,6 +5,9 @@ on: push: branches: [ main ] + pull_request: + branches: [ main ] + # Trigger manually workflow_dispatch: From c409a5371e94373de29bca3f7038d74e49523a6d Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 12:39:23 -0400 Subject: [PATCH 03/10] change env name --- .github/workflows/react-cicd.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index 7c63a21..e4ee1ee 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -1,4 +1,4 @@ -name: React App - CI/CD Workflow +name: React App - CI on: # Trigger when code committed to the main branch @@ -12,8 +12,7 @@ on: workflow_dispatch: env: - artifact-ui: ui - artifact-api: api + artifact: ui jobs: @@ -22,12 +21,12 @@ jobs: name: Build React app uses: msfred/templates/.github/workflows/build-react.yml@main with: - artifact: ${{ env.artifact-ui }} + artifact: ${{ env.artifact }} # Deploy React app deploy-dev-ui: name: Deploy to development uses: msfred/templates/.github/workflows/deploy-webapp.yml@main with: - artifact: ${{ env.artifact-ui }} + artifact: ${{ env.artifact }} environment: development From f091f317d964983510409d7b0c349ddd281535fe Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 12:44:16 -0400 Subject: [PATCH 04/10] change variable --- .github/workflows/react-cicd.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index bf63c63..09e14d1 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -21,13 +21,13 @@ jobs: name: Build React app uses: msfred/templates/.github/workflows/build-react.yml@main with: - artifact: ${{ env.artifact }} + artifact: $artifact # Deploy React app deploy-dev-ui: name: Deploy to development uses: msfred/templates/.github/workflows/deploy-webapp.yml@main with: - artifact: ${{ env.artifact }} + artifact: $artifact environment: development From 4435d2aac94750f67e46e2b8fd58938004cf1f7d Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 12:46:19 -0400 Subject: [PATCH 05/10] add webAppName param --- .github/workflows/react-cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index 09e14d1..6ef351e 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -30,4 +30,4 @@ jobs: with: artifact: $artifact environment: development - + webAppName: app-hrsampleproduct-ui From f077ed05dbb1cd0e0f8d55fc885f4681ee423ccc Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 12:47:34 -0400 Subject: [PATCH 06/10] add needs --- .github/workflows/react-cicd.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index 6ef351e..358d251 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -13,6 +13,7 @@ on: env: artifact: ui + webAppName: app-hrsampleproduct-ui jobs: @@ -26,8 +27,9 @@ jobs: # Deploy React app deploy-dev-ui: name: Deploy to development + needs: build-ui uses: msfred/templates/.github/workflows/deploy-webapp.yml@main with: artifact: $artifact environment: development - webAppName: app-hrsampleproduct-ui + webAppName: $webAppName From 54ee9e7877e64c075a7a221650d395a848642864 Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 12:51:09 -0400 Subject: [PATCH 07/10] add path --- .github/workflows/react-cicd.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index 358d251..765f91f 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -23,6 +23,7 @@ jobs: uses: msfred/templates/.github/workflows/build-react.yml@main with: artifact: $artifact + path: ui # Deploy React app deploy-dev-ui: From e83181cf335482e61ec8a26663b6f20a9195a735 Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:20:49 -0400 Subject: [PATCH 08/10] add path --- .github/workflows/react-cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index 765f91f..f11f85f 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -22,7 +22,7 @@ jobs: name: Build React app uses: msfred/templates/.github/workflows/build-react.yml@main with: - artifact: $artifact + artifact: ${{ env.artifact }} path: ui # Deploy React app From 52986cc1ce02d3b1b3c64693a67ba10452543760 Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:28:06 -0400 Subject: [PATCH 09/10] add path --- .github/workflows/react-cicd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index f11f85f..bc34d7e 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -22,7 +22,7 @@ jobs: name: Build React app uses: msfred/templates/.github/workflows/build-react.yml@main with: - artifact: ${{ env.artifact }} + artifact: ui path: ui # Deploy React app From 37a4eb4c258afad856bd0b92490d23363faffa08 Mon Sep 17 00:00:00 2001 From: Fred Gohsman <8670112+fredcicles@users.noreply.github.com> Date: Wed, 8 Jun 2022 13:51:52 -0400 Subject: [PATCH 10/10] add path --- .github/workflows/react-cicd.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/react-cicd.yml b/.github/workflows/react-cicd.yml index bc34d7e..1512b57 100644 --- a/.github/workflows/react-cicd.yml +++ b/.github/workflows/react-cicd.yml @@ -11,10 +11,6 @@ on: # Trigger manually workflow_dispatch: -env: - artifact: ui - webAppName: app-hrsampleproduct-ui - jobs: # Build React app @@ -31,6 +27,6 @@ jobs: needs: build-ui uses: msfred/templates/.github/workflows/deploy-webapp.yml@main with: - artifact: $artifact + artifact: ui environment: development - webAppName: $webAppName + webAppName: app-hrsampleproduct-ui