mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
Compare commits
6 Commits
9c4144f5c4
...
merge/clou
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ea02ed10c | |||
| afb8199cad | |||
| 1e23b32f30 | |||
| cdfaf3e66d | |||
| 21ccb00f4a | |||
| 901fff8651 |
4
.github/workflows/deploy-pr.yaml
vendored
4
.github/workflows/deploy-pr.yaml
vendored
@@ -60,8 +60,8 @@ jobs:
|
||||
- name: Helm upgrade/install PR preview
|
||||
env:
|
||||
DEV_BASE_DOMAIN: ${{ secrets.BASE_DOMAIN }}
|
||||
RABBITMQ_PASSWORD: ${{ secrets.RABBITMQ_PASSWORD }}
|
||||
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
|
||||
RABBITMQ_PASSWORD: ${{ secrets.PROD_RABBITMQ_PASSWORD }}
|
||||
DB_PASSWORD: ${{ secrets.PROD_DB_PASSWORD }}
|
||||
IMAGE_REPO: ${{ needs.build.outputs.image_repo }}
|
||||
DIGEST: ${{ needs.build.outputs.digest }}
|
||||
run: |
|
||||
|
||||
33
.github/workflows/frontend-pages.yml
vendored
33
.github/workflows/frontend-pages.yml
vendored
@@ -24,22 +24,6 @@ on:
|
||||
deployed_url:
|
||||
description: 'URL of deployed frontend'
|
||||
value: ${{ jobs.deploy.outputs.deployed_url }}
|
||||
push:
|
||||
branches: [ "main" ]
|
||||
paths:
|
||||
- '7project/frontend/**'
|
||||
- '.github/workflows/frontend-pages.yml'
|
||||
pull_request:
|
||||
branches: [ "main" ]
|
||||
paths:
|
||||
- '7project/frontend/**'
|
||||
- '.github/workflows/frontend-pages.yml'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
project_name:
|
||||
description: 'Cloudflare Pages project name (overrides default)'
|
||||
required: false
|
||||
type: string
|
||||
|
||||
# Required repository secrets:
|
||||
# CLOUDFLARE_API_TOKEN - API token with Pages:Edit (or Account:Workers Scripts:Edit) permissions
|
||||
@@ -131,9 +115,11 @@ jobs:
|
||||
# Prefer manual input, then repo variable, fallback to repo-name
|
||||
INPUT_NAME='${{ inputs.project_name }}'
|
||||
VAR_NAME='${{ vars.CF_PAGES_PROJECT_NAME }}'
|
||||
if [ -n "$INPUT_NAME" ]; then PNAME="$INPUT_NAME";
|
||||
elif [ -n "$VAR_NAME" ]; then PNAME="$VAR_NAME";
|
||||
else PNAME="${GITHUB_REPOSITORY##*/}-frontend"; fi
|
||||
if [ -n "$INPUT_NAME" ]; then PNAME_RAW="$INPUT_NAME";
|
||||
elif [ -n "$VAR_NAME" ]; then PNAME_RAW="$VAR_NAME";
|
||||
else PNAME_RAW="${GITHUB_REPOSITORY##*/}-frontend"; fi
|
||||
# Normalize project name to lowercase to satisfy Cloudflare Pages naming
|
||||
PNAME="${PNAME_RAW,,}"
|
||||
# Determine branch for Pages
|
||||
if [ "${INPUT_MODE}" = "pr" ]; then
|
||||
if [ -z "${INPUT_PR}" ]; then echo "pr_number is required when mode=pr"; exit 1; fi
|
||||
@@ -144,6 +130,15 @@ jobs:
|
||||
echo "project_name=$PNAME" >> $GITHUB_OUTPUT
|
||||
echo "branch=$PBRANCH" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Ensure Cloudflare Pages project exists
|
||||
env:
|
||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
||||
PNAME: ${{ steps.pname.outputs.project_name }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
npx wrangler pages project create "$PNAME" --production-branch=main || true
|
||||
|
||||
- name: Deploy using Cloudflare Wrangler
|
||||
uses: cloudflare/wrangler-action@v3
|
||||
with:
|
||||
|
||||
2
7project/frontend/src/config.ts
Normal file
2
7project/frontend/src/config.ts
Normal file
@@ -0,0 +1,2 @@
|
||||
export const BACKEND_URL: string =
|
||||
import.meta.env.VITE_BACKEND_URL ?? '';
|
||||
Reference in New Issue
Block a user