File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed
Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 11name : Build & Deploy Flutter Web → GitHub Pages
22
3- # Run on pushes to main
43on :
54 push :
65 branches :
76 - main
87
9- # Minimal permissions required to publish to Pages
108permissions :
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
You can’t perform that action at this time.
0 commit comments