From 9ac5eff5a3a1eccb4a58b0a64f2797d914f34661 Mon Sep 17 00:00:00 2001 From: Clemence Kyara Date: Mon, 7 Oct 2024 15:59:48 +0300 Subject: [PATCH] Add callable workflows to build apps in dev and prod --- .github/workflows/_cd-dev.yaml | 33 +++++++++++++++++++++++++ .github/workflows/_cd-prod.yaml | 43 +++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/_cd-dev.yaml create mode 100644 .github/workflows/_cd-prod.yaml diff --git a/.github/workflows/_cd-dev.yaml b/.github/workflows/_cd-dev.yaml new file mode 100644 index 000000000..52dc8ba0a --- /dev/null +++ b/.github/workflows/_cd-dev.yaml @@ -0,0 +1,33 @@ +name: DEV | CD + +on: + workflow_call: + +jobs: + apps-path-filter: + name: + uses: ./.github/workflows/_app-path-filter.yaml + + cd-dev-charterafrica: + needs: + - apps-path-filter + if: ${{ needs.apps-path-filter.outputs.charterafrica == 'true' }} + uses: ./.github/workflows/_cd-codeforafrica.yaml + with: + NODE_ENV: "development" + app_url: "https://charterafrica.dev.codeforafrica.org" + git_remote_url: "ssh://azureuser@ui-1.dev.codeforafrica.org/charterafrica-ui" + tags: "codeforafrica/charterafrica-ui:${{ github.sha }}" + secrets: inherit + + cd-dev-codeforafrica: + needs: + - apps-path-filter + if: ${{ needs.apps-path-filter.outputs.codeforafrica == 'true' }} + uses: ./.github/workflows/_cd-codeforafrica.yaml + with: + NODE_ENV: "development" + app_url: "https://codeforafrica-ui.dev.codeforafrica.org" + git_remote_url: "ssh://azureuser@ui-1.dev.codeforafrica.org/codeofrafrica-ui" + tags: "codeforafrica/codeforafrica-ui:${{ github.sha }}" + secrets: inherit diff --git a/.github/workflows/_cd-prod.yaml b/.github/workflows/_cd-prod.yaml new file mode 100644 index 000000000..87966c628 --- /dev/null +++ b/.github/workflows/_cd-prod.yaml @@ -0,0 +1,43 @@ +name: PROD | CD + +on: + workflow_call: + +jobs: + version-check-charterafrica: + name: Version Check | charterafrica + uses: ./.github/workflows/_app-version-check.yaml + with: + file-name: "./apps/charterafrica/package.json" + + version-check-codeforafrica: + name: Version Check | codeforafrica + uses: ./.github/workflows/_app-version-check.yaml + with: + file-name: "./apps/codeforafrica/package.json" + + prod-cd-charterafrica: + name: Deploy | charterafrica + needs: + - version-check-charterafrica + if: ${{ needs.version-check-charterafrica.outputs.changed == 'true' }} + uses: ./.github/workflows/_cd-charterafrica.yaml + with: + NODE_ENV: production + app_url: https://charter.africa + git_remote_url: ssh://dokku@ui-1.prod.codeforafrica.org/charterafrica-ui + tags: "codeforafrica/charterafrica-ui:${{ needs.version-check-charterafrica.outputs.version }}" + secrets: inherit + + prod-cd-codeforafrica: + name: Deploy | charterafrica + needs: + - version-check-codeforafrica + if: ${{ needs.version-check-codeforafrica.outputs.changed == 'true' }} + uses: ./.github/workflows/_cd-codeforafrica.yaml + with: + NODE_ENV: production + app_url: https://cfa.dev.codeforafrica.org + git_remote_url: ssh://dokku@ui-1.prod.codeforafrica.org/codeforafrica-ui + tags: "codeforafrica/codeforafrica-ui:${{ needs.version-check-codeforafrica.outputs.version }}" + secrets: inherit