@@ -145,74 +145,23 @@ jobs:
145145 body: `${icon} **${message}**\n\n**Built with:** Vite\n**Status:** ${status.toUpperCase()}`
146146 });
147147
148- # Job 4b: Deploy to GitHub Pages (Develop Branch )
149- deploy-develop :
150- name : Deploy to /development/
148+ # Job 4b: Deploy to GitHub Pages (Unified )
149+ deploy :
150+ name : Deploy to GitHub Pages
151151 needs : build
152152 runs-on : ubuntu-latest
153- if : needs.build.outputs.build_status == 'success' && github.ref_name == 'develop'
154-
155- # Ensure only one gh-pages deployment runs at a time
156- concurrency :
157- group : " gh-pages-deployment"
158- cancel-in-progress : false
159-
160- steps :
161- - name : Download build artifact
162- uses : actions/download-artifact@v4
163- with :
164- name : github-pages
165- path : artifact
166-
167- - name : Extract artifact
168- run : |
169- cd artifact
170- tar -xf artifact.tar
171- mkdir -p ../dist
172- mv * ../dist/ 2>/dev/null || true
173- cd ..
174- rm -rf artifact
175-
176- - name : Deploy to /development/ subdirectory
177- uses : peaceiris/actions-gh-pages@v4
178- with :
179- github_token : ${{ secrets.GITHUB_TOKEN }}
180- publish_dir : ./dist
181- destination_dir : development
182- keep_files : true
183- user_name : ' github-actions[bot]'
184- user_email : ' github-actions[bot]@users.noreply.github.com'
185- commit_message : ' Deploy develop branch to /development/'
186-
187- - name : Report deployment success
188- run : |
189- echo "🚀 DEPLOYMENT SUCCESSFUL"
190- echo "================================"
191- echo "Branch: develop"
192- echo "URL: https://www.unityailab.com/development/"
193- echo "Built with: Vite (optimized)"
194- echo "================================"
195-
196- # Job 4c: Deploy to GitHub Pages (Main Branch)
197- deploy-main :
198- name : Deploy to Root
199- needs : build
200- runs-on : ubuntu-latest
201- if : needs.build.outputs.build_status == 'success' && (github.ref_name == 'main' || github.ref_name == 'master')
202-
203- # Ensure only one gh-pages deployment runs at a time
204- concurrency :
205- group : " gh-pages-deployment"
206- cancel-in-progress : false
153+ if : needs.build.outputs.build_status == 'success'
207154
208155 steps :
209- - name : Checkout gh-pages branch
156+ - name : Checkout gh-pages branch (for main branch only)
157+ if : github.ref_name == 'main' || github.ref_name == 'master'
210158 uses : actions/checkout@v4
211159 with :
212160 ref : gh-pages
213161 path : gh-pages-backup
214162
215- - name : Preserve /development/ folder
163+ - name : Preserve /development/ folder (for main branch only)
164+ if : github.ref_name == 'main' || github.ref_name == 'master'
216165 run : |
217166 if [ -d "gh-pages-backup/development" ]; then
218167 cp -r gh-pages-backup/development /tmp/development-backup
@@ -236,28 +185,39 @@ jobs:
236185 cd ..
237186 rm -rf artifact
238187
239- - name : Restore /development/ folder to build
188+ - name : Restore /development/ folder (for main branch only)
189+ if : github.ref_name == 'main' || github.ref_name == 'master'
240190 run : |
241191 if [ -d "/tmp/development-backup" ]; then
242192 cp -r /tmp/development-backup dist/development
243193 echo "♻️ Restored /development/ folder to deployment"
244194 fi
245195
246- - name : Deploy to root directory
196+ - name : Deploy to GitHub Pages
247197 uses : peaceiris/actions-gh-pages@v4
248198 with :
249199 github_token : ${{ secrets.GITHUB_TOKEN }}
250200 publish_dir : ./dist
251- keep_files : false
201+ destination_dir : ${{ github.ref_name == 'develop' && 'development' || '.' }}
202+ keep_files : ${{ github.ref_name == 'develop' && 'true' || 'false' }}
252203 user_name : ' github-actions[bot]'
253204 user_email : ' github-actions[bot]@users.noreply.github.com'
254- commit_message : ' Deploy main branch to root '
205+ commit_message : ' Deploy ${{ github.ref_name }} branch '
255206
256207 - name : Report deployment success
257208 run : |
209+ if [ "${{ github.ref_name }}" == "develop" ]; then
210+ DEPLOY_URL="https://www.unityailab.com/development/"
211+ DEPLOY_PATH="/development/"
212+ else
213+ DEPLOY_URL="https://www.unityailab.com/"
214+ DEPLOY_PATH="root"
215+ fi
216+
258217 echo "🚀 DEPLOYMENT SUCCESSFUL"
259218 echo "================================"
260219 echo "Branch: ${{ github.ref_name }}"
261- echo "URL: https://www.unityailab.com/"
220+ echo "Deploy Path: $DEPLOY_PATH"
221+ echo "URL: $DEPLOY_URL"
262222 echo "Built with: Vite (optimized)"
263223 echo "================================"
0 commit comments