From 5ea11cdd74880596df1bc77329b73d79bc227805 Mon Sep 17 00:00:00 2001 From: Adam Jones Date: Sat, 20 Apr 2024 15:22:12 +0100 Subject: [PATCH] Add frontend_example CD --- .github/workflows/ci_cd.yaml | 39 +++++++++++++++++-- apps/backend/tools/deployDocker.sh | 2 + apps/bubble-proxy/tools/deployDocker.sh | 2 + apps/frontend-example/src/pages/index.tsx | 2 +- apps/frontend-example/tools/deployDocker.sh | 2 + .../tools/deployDocker.sh | 2 + package-lock.json | 7 ++++ 7 files changed, 51 insertions(+), 5 deletions(-) diff --git a/.github/workflows/ci_cd.yaml b/.github/workflows/ci_cd.yaml index eba580b..75b2290 100644 --- a/.github/workflows/ci_cd.yaml +++ b/.github/workflows/ci_cd.yaml @@ -45,10 +45,13 @@ jobs: - 'apps/bubble-proxy/**' frontend-example: paths: - - 'apps/bubble-proxy/**' + - 'apps/frontend-example/**' infra: paths: - 'apps/infra/**' + miniextensions-proxy: + paths: + - 'apps/miniextensions-proxy/**' paths: - 'package-lock.json' outputs: @@ -74,7 +77,6 @@ jobs: run: npm ci - name: Configure for deployment - if: github.ref == 'refs/heads/master' run: | echo "$INFRA_PULUMI_PASSPHRASE" > apps/infra/passphrase.prod.txt @@ -85,5 +87,34 @@ jobs: # See the infra README - these should actually have details for Vultr Object Storage INFRA_AWS_CREDENTIALS: ${{ secrets.INFRA_AWS_CREDENTIALS }} - name: Deploy - if: ${{ github.ref == 'refs/heads/master' }} - run: npm run deploy:prod --workspace apps/infra \ No newline at end of file + run: npm run deploy:prod --workspace apps/infra + + cd_frontend-example: + needs: ci + if: ${{ github.ref == 'refs/heads/master' && needs.ci.outputs.should_skip != 'true' || !fromJSON(needs.ci.outputs.paths_result).frontend-example.should_skip }} + runs-on: ubuntu-latest + concurrency: + group: prevent-concurrent-jobs + timeout-minutes: 10 + steps: + - name: Checkout ${{ github.sha }} + uses: actions/checkout@v4 + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - name: Install NPM dependencies + run: npm ci + + - name: Configure for deployment + run: | + docker login https://sjc.vultrcr.com/bluedot -u dbaa58f3-01f1-4fcc-9c14-93cc28f524e0 -p $VULTR_CONTAINER_REGISTRY_PASSWORD + + mkdir -p ~/.kube + echo "$K8S_KUBECONFIG" > ~/.kube/config + env: + K8S_KUBECONFIG: ${{ secrets.K8S_KUBECONFIG }} + VULTR_CONTAINER_REGISTRY_PASSWORD: ${{ secrets.VULTR_CONTAINER_REGISTRY_PASSWORD }} + - name: Deploy + run: npm run deploy:prod --workspace apps/frontend-example \ No newline at end of file diff --git a/apps/backend/tools/deployDocker.sh b/apps/backend/tools/deployDocker.sh index 029a521..e660e8b 100755 --- a/apps/backend/tools/deployDocker.sh +++ b/apps/backend/tools/deployDocker.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euxo pipefail +cd $(dirname "${BASH_SOURCE[0]:-$0}")/.. + APP_NAME=$(basename "$PWD") REPO_URL="sjc.vultrcr.com/bluedot" IMAGE_NAME="bluedot-$APP_NAME" diff --git a/apps/bubble-proxy/tools/deployDocker.sh b/apps/bubble-proxy/tools/deployDocker.sh index 029a521..e660e8b 100755 --- a/apps/bubble-proxy/tools/deployDocker.sh +++ b/apps/bubble-proxy/tools/deployDocker.sh @@ -1,6 +1,8 @@ #!/usr/bin/env bash set -euxo pipefail +cd $(dirname "${BASH_SOURCE[0]:-$0}")/.. + APP_NAME=$(basename "$PWD") REPO_URL="sjc.vultrcr.com/bluedot" IMAGE_NAME="bluedot-$APP_NAME" diff --git a/apps/frontend-example/src/pages/index.tsx b/apps/frontend-example/src/pages/index.tsx index eb89822..6224739 100644 --- a/apps/frontend-example/src/pages/index.tsx +++ b/apps/frontend-example/src/pages/index.tsx @@ -8,7 +8,7 @@ const HomePage = () => { return (
-

Homepage

+

frontend-example

This is some example text