mirror of
https://github.com/dat515-2025/Group-8.git
synced 2026-03-22 15:12:08 +01:00
fix(infrastructure): use correct runner
This commit is contained in:
41
.github/workflows/deploy-pr.yaml
vendored
41
.github/workflows/deploy-pr.yaml
vendored
@@ -20,17 +20,9 @@ jobs:
|
|||||||
pr_number: ${{ github.event.pull_request.number }}
|
pr_number: ${{ github.event.pull_request.number }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
frontend:
|
get_urls:
|
||||||
if: github.event.action != 'closed'
|
|
||||||
name: Frontend - Build and Deploy to Cloudflare Pages (PR)
|
|
||||||
uses: ./.github/workflows/frontend-pages.yml
|
|
||||||
with:
|
|
||||||
mode: pr
|
|
||||||
pr_number: ${{ github.event.pull_request.number }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
get_urls_2:
|
|
||||||
if: github.event.action != 'closed'
|
if: github.event.action != 'closed'
|
||||||
|
name: Generate Preview URLs
|
||||||
uses: ./.github/workflows/url_generator.yml
|
uses: ./.github/workflows/url_generator.yml
|
||||||
with:
|
with:
|
||||||
runner: vhs
|
runner: vhs
|
||||||
@@ -38,6 +30,17 @@ jobs:
|
|||||||
pr_number: ${{ github.event.pull_request.number }}
|
pr_number: ${{ github.event.pull_request.number }}
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
|
frontend:
|
||||||
|
if: github.event.action != 'closed'
|
||||||
|
name: Frontend - Build and Deploy to Cloudflare Pages (PR)
|
||||||
|
needs: [get_urls]
|
||||||
|
uses: ./.github/workflows/frontend-pages.yml
|
||||||
|
with:
|
||||||
|
mode: pr
|
||||||
|
pr_number: ${{ github.event.pull_request.number }}
|
||||||
|
backend_url_scheme: ${{ needs.get_urls.outputs.backend_url_scheme }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
if: github.event.action != 'closed'
|
if: github.event.action != 'closed'
|
||||||
name: Helm upgrade/install (PR preview)
|
name: Helm upgrade/install (PR preview)
|
||||||
@@ -45,7 +48,7 @@ jobs:
|
|||||||
concurrency:
|
concurrency:
|
||||||
group: pr-${{ github.event.pull_request.number }}
|
group: pr-${{ github.event.pull_request.number }}
|
||||||
cancel-in-progress: false
|
cancel-in-progress: false
|
||||||
needs: [build, frontend, get_urls_2]
|
needs: [build, frontend, get_urls]
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -72,13 +75,11 @@ jobs:
|
|||||||
RABBITMQ_PASSWORD: ${{ secrets.PROD_RABBITMQ_PASSWORD }}
|
RABBITMQ_PASSWORD: ${{ secrets.PROD_RABBITMQ_PASSWORD }}
|
||||||
DB_PASSWORD: ${{ secrets.PROD_DB_PASSWORD }}
|
DB_PASSWORD: ${{ secrets.PROD_DB_PASSWORD }}
|
||||||
DIGEST: ${{ needs.build.outputs.digest }}
|
DIGEST: ${{ needs.build.outputs.digest }}
|
||||||
DOMAIN: "${{ needs.get_urls_2.outputs.backend_url }}"
|
DOMAIN: "${{ needs.get_urls.outputs.backend_url }}"
|
||||||
DOMAIN_SCHEME: "${{ needs.get_urls_2.outputs.backend_url_scheme }}"
|
DOMAIN_SCHEME: "${{ needs.get_urls.outputs.backend_url_scheme }}"
|
||||||
FRONTEND_DOMAIN: "${{ needs.get_urls_2.outputs.frontend_url }}"
|
FRONTEND_DOMAIN: "${{ needs.get_urls.outputs.frontend_url }}"
|
||||||
FRONTEND_DOMAIN_SCHEME: "${{ needs.get_urls_2.outputs.frontend_url_scheme }}"
|
FRONTEND_DOMAIN_SCHEME: "${{ needs.get_urls.outputs.frontend_url_scheme }}"
|
||||||
run: |
|
run: |
|
||||||
#print env
|
|
||||||
env | sort
|
|
||||||
PR=${{ github.event.pull_request.number }}
|
PR=${{ github.event.pull_request.number }}
|
||||||
RELEASE=myapp-pr-$PR
|
RELEASE=myapp-pr-$PR
|
||||||
NAMESPACE=pr-$PR
|
NAMESPACE=pr-$PR
|
||||||
@@ -98,8 +99,8 @@ jobs:
|
|||||||
- name: Post preview URLs as PR comment
|
- name: Post preview URLs as PR comment
|
||||||
uses: actions/github-script@v7
|
uses: actions/github-script@v7
|
||||||
env:
|
env:
|
||||||
BACKEND_URL: ${{ needs.get_urls_2.outputs.backend_url_scheme }}
|
BACKEND_URL: ${{ needs.get_urls.outputs.backend_url_scheme }}
|
||||||
FRONTEND_URL: ${{ needs.get_urls_2.outputs.frontend_url_scheme }}
|
FRONTEND_URL: ${{ needs.get_urls.outputs.frontend_url_scheme }}
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const pr = context.payload.pull_request;
|
const pr = context.payload.pull_request;
|
||||||
@@ -107,7 +108,7 @@ jobs:
|
|||||||
const prNumber = pr.number;
|
const prNumber = pr.number;
|
||||||
const backendUrl = process.env.BACKEND_URL || '(not available)';
|
const backendUrl = process.env.BACKEND_URL || '(not available)';
|
||||||
const frontendUrl = process.env.FRONTEND_URL || '(not available)';
|
const frontendUrl = process.env.FRONTEND_URL || '(not available)';
|
||||||
const marker = '<!-- preview-link -->';
|
const marker = '';
|
||||||
const body = `${marker}\nPreview environment is running\n- Frontend: ${frontendUrl}\n- Backend: ${backendUrl}\n`;
|
const body = `${marker}\nPreview environment is running\n- Frontend: ${frontendUrl}\n- Backend: ${backendUrl}\n`;
|
||||||
const { owner, repo } = context.repo;
|
const { owner, repo } = context.repo;
|
||||||
const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: prNumber, per_page: 100 });
|
const { data: comments } = await github.rest.issues.listComments({ owner, repo, issue_number: prNumber, per_page: 100 });
|
||||||
|
|||||||
16
.github/workflows/frontend-pages.yml
vendored
16
.github/workflows/frontend-pages.yml
vendored
@@ -15,6 +15,10 @@ on:
|
|||||||
description: 'Cloudflare Pages project name (overrides default)'
|
description: 'Cloudflare Pages project name (overrides default)'
|
||||||
required: false
|
required: false
|
||||||
type: string
|
type: string
|
||||||
|
backend_url_scheme:
|
||||||
|
description: 'The full scheme URL for the backend (e.g., https://api.example.com)'
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
secrets:
|
secrets:
|
||||||
CLOUDFLARE_API_TOKEN:
|
CLOUDFLARE_API_TOKEN:
|
||||||
required: true
|
required: true
|
||||||
@@ -26,17 +30,9 @@ on:
|
|||||||
value: ${{ jobs.deploy.outputs.deployed_url }}
|
value: ${{ jobs.deploy.outputs.deployed_url }}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
get_urls:
|
|
||||||
uses: ./.github/workflows/url_generator.yml
|
|
||||||
with:
|
|
||||||
mode: ${{ inputs.mode }}
|
|
||||||
pr_number: ${{ inputs.pr_number }}
|
|
||||||
secrets: inherit
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
name: Build frontend
|
name: Build frontend
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
needs: [get_urls]
|
|
||||||
defaults:
|
defaults:
|
||||||
run:
|
run:
|
||||||
working-directory: 7project/frontend
|
working-directory: 7project/frontend
|
||||||
@@ -54,9 +50,9 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Set backend URL from url_generator
|
- name: Set backend URL from workflow input
|
||||||
run: |
|
run: |
|
||||||
echo "VITE_BACKEND_URL=${{ needs.get_urls.outputs.backend_url_scheme }}" >> $GITHUB_ENV
|
echo "VITE_BACKEND_URL=${{ inputs.backend_url_scheme }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|||||||
Reference in New Issue
Block a user