-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (97 loc) · 3.52 KB
/
deploy.yml
File metadata and controls
114 lines (97 loc) · 3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Deploy to GitHub Pages (Emergency Only)
# IMPORTANT: This workflow is for EMERGENCY manual deployments only
# Normal deployments happen automatically as part of the release workflow
# which ensures backend changes are coordinated with frontend deployments.
#
# Use this workflow ONLY when:
# - You need to deploy a hotfix outside the normal release cycle
# - The release workflow is broken and you need to deploy immediately
#
# Before running this workflow manually, ensure:
# 1. The backend API is deployed and ready
# 2. API_URL secret is configured in GitHub repository settings
# OR NEXT_PUBLIC_API_URL is updated in the build step below
on:
workflow_dispatch:
permissions:
contents: read
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
test:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: "3.14"
cache: "pip"
cache-dependency-path: backend/requirements.txt
- name: Install backend dependencies
run: .github/scripts/install-backend-deps.sh
- name: Run backend tests with coverage
run: .github/scripts/run-backend-tests.sh
- name: Upload coverage to Codecov
uses: codecov/codecov-action@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./backend/coverage.xml
flags: backend
name: backend-coverage
- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@0fa95f0e1eeaafde2c782583b36b28ad0d8c77d3 # v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
build:
runs-on: ubuntu-latest
needs: test
environment: production
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
persist-credentials: false
- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
with:
node-version: "24"
cache: "npm"
cache-dependency-path: frontend/package-lock.json
- name: Setup Pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6
- name: Install dependencies
working-directory: ./frontend
run: npm ci
- name: Build with Next.js
working-directory: ./frontend
run: npm run build
env:
# Configure your backend API URL here or use GitHub Secrets
# Option 1: Direct URL (quick start)
# NEXT_PUBLIC_API_URL: https://your-backend-api.railway.app/api/v1
# Option 2: GitHub Secret (recommended for production)
NEXT_PUBLIC_API_URL: ${{ secrets.API_URL || 'https://api.hadiscover.com/api/v1' }}
- name: Upload artifact
uses: actions/upload-pages-artifact@7b1f4a764d45c48632c6b24a0339c27f5614fb0b # v4
with:
path: ./frontend/out
deploy:
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5