Skip to content

Commit 9074e74

Browse files
hackall360claude
andcommitted
Merge develop: Fix dual-branch GitHub Pages deployment
Merging deployment configuration fixes from develop to restore www.unityailab.com and enable proper dual-branch deployment: - Main branch → www.unityailab.com (root) - Develop branch → www.unityailab.com/development/ Changes: - Fixed deployment workflow to prevent overwrites - Preserve CNAME and separate directories per branch - Updated documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
2 parents 11beebb + fccfba8 commit 9074e74

11 files changed

Lines changed: 803 additions & 639 deletions

File tree

.claude/settings.local.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(test:*)",
5+
"Bash(powershell:*)"
6+
],
7+
"deny": [],
8+
"ask": []
9+
}
10+
}

.github/workflows/deploy.yml

Lines changed: 87 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: Build and Deploy
22

3-
# Run on push to main/master branch
3+
# Run on push to main/master/develop branch
44
on:
55
push:
66
branches:
77
- main
88
- master
9+
- develop
910
workflow_dispatch: # Allow manual triggering
1011

1112
# Grant necessary permissions
@@ -16,9 +17,9 @@ permissions:
1617
issues: write
1718
pull-requests: write
1819

19-
# Ensure only one deployment runs at a time
20+
# Ensure only one deployment runs at a time per branch
2021
concurrency:
21-
group: "pages"
22+
group: "pages-${{ github.ref_name }}"
2223
cancel-in-progress: false
2324

2425
jobs:
@@ -152,20 +153,95 @@ jobs:
152153
runs-on: ubuntu-latest
153154
if: needs.build.outputs.build_status == 'success'
154155

155-
environment:
156-
name: github-pages
157-
url: ${{ steps.deployment.outputs.page_url }}
158-
159156
steps:
160-
- name: Deploy to GitHub Pages
161-
id: deployment
162-
uses: actions/deploy-pages@v4
157+
- name: Checkout gh-pages branch
158+
uses: actions/checkout@v4
159+
with:
160+
ref: gh-pages
161+
path: gh-pages-repo
162+
163+
- name: Download build artifact
164+
uses: actions/download-artifact@v4
165+
with:
166+
name: github-pages
167+
path: artifact
168+
169+
- name: Extract artifact
170+
run: |
171+
cd artifact
172+
tar -xf artifact.tar
173+
mkdir -p ../dist
174+
mv -f * ../dist/ 2>/dev/null || true
175+
cd ..
176+
rm -rf artifact
177+
178+
- name: Determine deployment path and update files
179+
id: deploy-path
180+
run: |
181+
if [ "${{ github.ref_name }}" == "develop" ]; then
182+
echo "📍 Deploying develop branch to /development/ subdirectory"
183+
echo "url=https://www.unityailab.com/development/" >> $GITHUB_OUTPUT
184+
185+
# Remove old development folder and copy new build
186+
rm -rf gh-pages-repo/development
187+
mkdir -p gh-pages-repo/development
188+
cp -r dist/* gh-pages-repo/development/
189+
190+
echo "✅ Updated /development/ folder only"
191+
else
192+
echo "📍 Deploying main branch to root directory"
193+
echo "url=https://www.unityailab.com/" >> $GITHUB_OUTPUT
194+
195+
# Preserve CNAME and development folder
196+
if [ -f "gh-pages-repo/CNAME" ]; then
197+
cp gh-pages-repo/CNAME /tmp/CNAME
198+
echo "💾 Preserved CNAME file"
199+
fi
200+
201+
if [ -d "gh-pages-repo/development" ]; then
202+
mv gh-pages-repo/development /tmp/development
203+
echo "💾 Preserved /development/ folder"
204+
fi
205+
206+
# Clear root and copy new build
207+
rm -rf gh-pages-repo/*
208+
cp -r dist/* gh-pages-repo/
209+
210+
# Restore preserved files
211+
if [ -f "/tmp/CNAME" ]; then
212+
mv /tmp/CNAME gh-pages-repo/CNAME
213+
echo "♻️ Restored CNAME file"
214+
fi
215+
216+
if [ -d "/tmp/development" ]; then
217+
mv /tmp/development gh-pages-repo/development
218+
echo "♻️ Restored /development/ folder"
219+
fi
220+
221+
echo "✅ Updated root files while preserving /development/"
222+
fi
223+
224+
- name: Commit and push to gh-pages
225+
run: |
226+
cd gh-pages-repo
227+
git config user.name 'github-actions[bot]'
228+
git config user.email 'github-actions[bot]@users.noreply.github.com'
229+
git add -A
230+
231+
if git diff --staged --quiet; then
232+
echo "No changes to deploy"
233+
else
234+
git commit -m "Deploy from ${{ github.ref_name }} branch - $(date +'%Y-%m-%d %H:%M:%S')"
235+
git push origin gh-pages
236+
echo "✅ Deployed successfully"
237+
fi
163238
164239
- name: Report deployment success
165240
run: |
166241
echo "🚀 DEPLOYMENT SUCCESSFUL"
167242
echo "================================"
168-
echo "URL: ${{ steps.deployment.outputs.page_url }}"
243+
echo "Branch: ${{ github.ref_name }}"
244+
echo "URL: ${{ steps.deploy-path.outputs.url }}"
169245
echo "Built with: Vite (optimized)"
170246
echo "================================"
171247
echo ""

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ test-output*.txt
1111
test-output.log
1212
standalone-test-results.log
1313
*.log
14+
15+
# Claude personal
16+
.claude/

Docs/TODO/infrastructure-TODO.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,12 @@ This TODO covers all backend infrastructure, DevOps, security, documentation, an
9090
---
9191

9292
### P1 CI/CD
93-
**Status:** Partial (GitHub workflow exists for cache-busting)
93+
**Status:** Partial (GitHub workflow exists for dual-branch deployment)
9494

9595
- [x] Basic deployment workflow (`.github/workflows/deploy.yml`)
96+
- [x] Main branch deploys to root
97+
- [x] Develop branch deploys to /development/ subdirectory
98+
- [x] Separate concurrency groups per branch
9699
- [ ] Lint and type-check
97100
- [ ] ESLint for JavaScript
98101
- [ ] Pylint/Black for Python

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,15 @@ This is a test site for validating:
211211

212212
Changes tested here are promoted to the main Unity AI Lab website after validation.
213213

214+
### Deployment
215+
216+
The repository uses automated GitHub Actions deployment with dual-branch support:
217+
218+
- **Main Branch** → Deploys to root: `https://unity-lab-ai.github.io/`
219+
- **Develop Branch** → Deploys to `/development/`: `https://unity-lab-ai.github.io/development/`
220+
221+
This allows live testing of develop branch changes without affecting the production site. Both deployments run independently with separate concurrency groups.
222+
214223
## Documentation
215224

216225
### For Developers & AI Assistants

apps/helperInterfaceDemo/helperInterface.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,8 @@ async function sendMessage(message) {
474474
requestBody.seed = Math.floor(Math.random() * 1000000);
475475
}
476476

477-
const response = await polliAPI.retryRequest(PollinationsAPI.TEXT_API, {
477+
// Use direct fetch like demo page
478+
const response = await fetch(`${PollinationsAPI.TEXT_API}?referrer=${encodeURIComponent(polliAPI.referrer)}`, {
478479
method: "POST",
479480
headers: {
480481
"Content-Type": "application/json"
@@ -548,7 +549,8 @@ async function fetchModels() {
548549
modelSelect.innerHTML = "";
549550

550551
try {
551-
const response = await polliAPI.retryRequest(`${PollinationsAPI.TEXT_API}/models`);
552+
// Use direct fetch like demo page
553+
const response = await fetch(`${PollinationsAPI.TEXT_API}/models?referrer=${encodeURIComponent(polliAPI.referrer)}`);
552554
if (!response.ok) throw new Error("Failed to fetch models");
553555

554556
const data = await response.json();
@@ -782,7 +784,8 @@ async function getImageDescription(imageUrl) {
782784
jsonMode: false
783785
};
784786

785-
const response = await polliAPI.retryRequest(PollinationsAPI.TEXT_API, {
787+
// Use direct fetch like demo page
788+
const response = await fetch(`${PollinationsAPI.TEXT_API}?referrer=${encodeURIComponent(polliAPI.referrer)}`, {
786789
method: "POST",
787790
headers: { "Content-Type": "application/json" },
788791
body: JSON.stringify(requestBody)

apps/personaDemo/persona.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ const imageModel = document.getElementById('imageModel');
2020
// Fetch Text Models
2121
async function fetchTextModels() {
2222
try {
23-
const response = await polliAPI.retryRequest(`${PollinationsAPI.TEXT_API}/models`);
23+
// Use direct fetch like demo page
24+
const response = await fetch(`${PollinationsAPI.TEXT_API}/models?referrer=${encodeURIComponent(polliAPI.referrer)}`);
2425
const models = await response.json();
2526
textModel.innerHTML = '';
2627
models.forEach(model => {
@@ -37,7 +38,8 @@ async function fetchTextModels() {
3738
// Fetch Image Models
3839
async function fetchImageModels() {
3940
try {
40-
const response = await polliAPI.retryRequest(`${PollinationsAPI.IMAGE_API}/models`);
41+
// Use direct fetch like demo page
42+
const response = await fetch(`${PollinationsAPI.IMAGE_API}/models?referrer=${encodeURIComponent(polliAPI.referrer)}`);
4143
const models = await response.json();
4244
imageModel.innerHTML = '';
4345
models.forEach(model => {
@@ -370,7 +372,8 @@ async function generateImageFromPrompt(prompt, appendToChat = true) {
370372
const encodedPrompt = polliAPI.encodePrompt(prompt);
371373
const imageUrl = `${PollinationsAPI.IMAGE_API}/prompt/${encodedPrompt}?seed=${randomSeed}&model=${selectedModel}&width=${width}&height=${height}&nofeed=true&nologo=true&enhance=false&referrer=${encodeURIComponent(polliAPI.referrer)}`;
372374
try {
373-
const response = await polliAPI.retryRequest(imageUrl);
375+
// Use direct fetch like demo page
376+
const response = await fetch(imageUrl);
374377
if (response.ok) {
375378
const imageBlob = await response.blob();
376379
const imageObjectURL = URL.createObjectURL(imageBlob);
@@ -416,7 +419,8 @@ chatForm.onsubmit = async function(event) {
416419
chatOutput.innerHTML += `<p id="ai-thinking"><em>${isEvil ? 'Evil AI plotting...' : 'AI is thinking...'}</em></p>`;
417420
scrollToBottom();
418421
try {
419-
const response = await polliAPI.retryRequest(PollinationsAPI.TEXT_API, {
422+
// Use direct fetch like demo page
423+
const response = await fetch(`${PollinationsAPI.TEXT_API}?referrer=${encodeURIComponent(polliAPI.referrer)}`, {
420424
method: 'POST',
421425
headers: { 'Content-Type': 'application/json' },
422426
body: JSON.stringify(requestBody)

0 commit comments

Comments
 (0)