Compare commits

3 Commits

Author SHA1 Message Date
fa1b9523a1 feat(infrastructure): add frontend, deploy to cloudflare
Some checks failed
Deploy Prod / Build and push image (reusable) (push) Has been cancelled
Deploy Prod / Frontend - Build and Deploy to Cloudflare Pages (prod) (push) Has been cancelled
Deploy Prod / Helm upgrade/install (prod) (push) Has been cancelled
2025-10-06 20:56:42 +02:00
e5fceb886b feat(infrastructure): add frontend, deploy to cloudflare 2025-10-06 18:48:01 +02:00
ec7c0cbc7a Merge pull request #16 from dat515-2025/merge/cloudflare-deploy
feat(infrastructure): add frontend, deploy to cloudflare
2025-10-06 18:44:31 +02:00
3 changed files with 29 additions and 11 deletions

View File

@@ -114,7 +114,7 @@ jobs:
uninstall: uninstall:
if: github.event.action == 'closed' if: github.event.action == 'closed'
name: Helm uninstall (PR preview) name: Helm uninstall (PR preview)
runs-on: ubuntu-latest runs-on: vhs
steps: steps:
- name: Setup Helm - name: Setup Helm
uses: azure/setup-helm@v4 uses: azure/setup-helm@v4

View File

@@ -5,9 +5,11 @@ on:
branches: [ "main" ] branches: [ "main" ]
paths: paths:
- 7project/backend/** - 7project/backend/**
- 7project/frontend/**
- 7project/charts/myapp-chart/** - 7project/charts/myapp-chart/**
- .github/workflows/deploy-prod.yaml - .github/workflows/deploy-prod.yaml
- .github/workflows/build-image.yaml - .github/workflows/build-image.yaml
- .github/workflows/frontend-pages.yml
workflow_dispatch: workflow_dispatch:
@@ -38,7 +40,7 @@ jobs:
deploy: deploy:
name: Helm upgrade/install (prod) name: Helm upgrade/install (prod)
runs-on: vhs runs-on: vhs
needs: [build] needs: [build, frontend]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4

View File

@@ -60,21 +60,37 @@ jobs:
EVENT_NAME: ${{ github.event_name }} EVENT_NAME: ${{ github.event_name }}
PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }} PR_NUMBER: ${{ github.event.pull_request.number || inputs.pr_number }}
PR_TEMPLATE: ${{ vars.BACKEND_URL_PR_TEMPLATE }} PR_TEMPLATE: ${{ vars.BACKEND_URL_PR_TEMPLATE }}
PROD_DOMAIN: ${{ vars.PROD_DOMAIN }} PROD_DOMAIN_VAR: ${{ vars.PROD_DOMAIN }}
PROD_DOMAIN_SECRET: ${{ secrets.PROD_DOMAIN }}
BACKEND_URL_OVERRIDE: ${{ vars.BACKEND_URL || secrets.BACKEND_URL }}
MODE: ${{ inputs.mode }} MODE: ${{ inputs.mode }}
run: | run: |
set -euo pipefail set -euo pipefail
URL="" URL=""
if [ -n "${PROD_DOMAIN:-}" ]; then # 1) Explicit override wins (from repo var or secret)
if echo "$PROD_DOMAIN" | grep -Eiq '^https?://'; then if [ -n "${BACKEND_URL_OVERRIDE:-}" ]; then
URL="$PROD_DOMAIN" if echo "$BACKEND_URL_OVERRIDE" | grep -Eiq '^https?://'; then
URL="$BACKEND_URL_OVERRIDE"
else else
URL="https://${PROD_DOMAIN}" URL="https://${BACKEND_URL_OVERRIDE}"
fi fi
fi else
if [ "${MODE:-}" = "pr" ] || [ "${EVENT_NAME}" = "pull_request" ]; then # 2) PR template when building for PR
if [ -n "${PR_TEMPLATE:-}" ] && [ -n "${PR_NUMBER:-}" ] ; then if [ "${MODE:-}" = "pr" ] || [ "${EVENT_NAME}" = "pull_request" ]; then
URL="${PR_TEMPLATE//\{PR\}/${PR_NUMBER}}" if [ -n "${PR_TEMPLATE:-}" ] && [ -n "${PR_NUMBER:-}" ] ; then
URL="${PR_TEMPLATE//\{PR\}/${PR_NUMBER}}"
fi
fi
# 3) Fallback to PROD_DOMAIN (prefer repo var, then secret)
if [ -z "$URL" ]; then
PROD_DOMAIN="${PROD_DOMAIN_VAR:-${PROD_DOMAIN_SECRET:-}}"
if [ -n "$PROD_DOMAIN" ]; then
if echo "$PROD_DOMAIN" | grep -Eiq '^https?://'; then
URL="$PROD_DOMAIN"
else
URL="https://${PROD_DOMAIN}"
fi
fi
fi fi
fi fi
echo "Using backend URL: ${URL:-<empty>}" echo "Using backend URL: ${URL:-<empty>}"