Skip to content

Commit f5aa8b8

Browse files
authored
fix : GH pages fix attempt 3
1 parent 3b2bf5e commit f5aa8b8

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

.github/workflows/deploy-to-gh-pages.yml

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,10 @@
11
name: Build & Deploy Flutter Web → GitHub Pages
22

3-
# Run on pushes to main
43
on:
54
push:
65
branches:
76
- main
87

9-
# Minimal permissions required to publish to Pages
108
permissions:
119
contents: read
1210
pages: write
@@ -49,14 +47,14 @@ jobs:
4947
run: |
5048
cp build/web/index.html build/web/404.html || true
5149
52-
# Optional: write CNAME from repo secret CUSTOM_DOMAIN (set if you use a custom domain)
50+
# Option A: Always-run step that writes CNAME only if CUSTOM_DOMAIN secret exists
5351
- name: Add CNAME (optional)
54-
if: ${{ secrets.CUSTOM_DOMAIN != '' }}
55-
run: echo "${{ secrets.CUSTOM_DOMAIN }}" > build/web/CNAME
52+
run: |
53+
if [ -n "${{ secrets.CUSTOM_DOMAIN }}" ]; then
54+
echo "Writing CNAME for domain: ${{ secrets.CUSTOM_DOMAIN }}"
55+
echo "${{ secrets.CUSTOM_DOMAIN }}" > build/web/CNAME
56+
else
57+
echo "CUSTOM_DOMAIN secret not set — skipping CNAME."
58+
fi
5659
5760
- name: Deploy to GitHub Pages (gh-pages branch)
58-
uses: peaceiris/actions-gh-pages@v3
59-
with:
60-
github_token: ${{ secrets.GITHUB_TOKEN }}
61-
publish_dir: build/web
62-
publish_branch: gh-pages

0 commit comments

Comments
 (0)