Skip to content

Commit 76a9b5f

Browse files
committed
fix: update permissions and improve git deployment with better error handling
1 parent d6e1978 commit 76a9b5f

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/workflows/deploy-pages.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ jobs:
196196
permissions:
197197
pages: write
198198
id-token: write
199-
contents: read
199+
contents: write
200200

201201
environment:
202202
name: github-pages
@@ -226,20 +226,27 @@ jobs:
226226
id: deployment
227227
run: |
228228
echo "🚀 Deploying to GitHub Pages..."
229-
229+
230230
# 配置 Git
231231
git config --global user.name "github-actions[bot]"
232232
git config --global user.email "github-actions[bot]@users.noreply.github.com"
233-
233+
234234
# 创建 gh-pages 分支并推送
235235
cd ./site-build
236+
echo "📁 Current directory: $(pwd)"
237+
echo "📊 Files to deploy: $(find . -type f | wc -l)"
238+
236239
git init
237240
git add .
238241
git commit -m "Deploy to GitHub Pages"
239242
git branch -M gh-pages
240-
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
241-
git push -f origin gh-pages
242243
244+
echo "🔗 Adding remote origin..."
245+
git remote add origin https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git
246+
247+
echo "📤 Pushing to gh-pages branch..."
248+
git push -f origin gh-pages
249+
243250
echo "✅ Deployment completed"
244251
245252
- name: Verify deployment

0 commit comments

Comments
 (0)