1+ # Workflow name
12name : Release to Github Pages
23
4+ # Triggers for the workflow
35on :
6+ # Run on pushes to the main branch
47 push :
58 branches : [main]
9+ # Allows manual triggering from the Actions tab
610 workflow_dispatch :
711
12+ # Permissions needed for deployment to GitHub Pages
813permissions :
914 contents : read
1015 pages : write
1116 id-token : write
1217
18+ # Concurrency settings to prevent multiple deployments at once
1319concurrency :
1420 group : " pages"
1521 cancel-in-progress : false
1622
1723jobs :
18- Github-Pages-Release :
24+ # The main job for building and deploying the site
25+ github-pages-release :
1926
27+ # Set a timeout to prevent jobs from running indefinitely
2028 timeout-minutes : 10
2129
30+ # Define the deployment environment
2231 environment :
2332 name : github-pages
2433 url : ${{ steps.deployment.outputs.page_url }}
2534
35+ # Use the latest Ubuntu runner
2636 runs-on : ubuntu-latest
2737
2838 steps :
29- - uses : actions/checkout@v4 # repo checkout
39+ # 1. Check out the repository's code
40+ - name : Checkout repository
41+ uses : actions/checkout@v4
3042
43+ # 2. Set up the Rust toolchain with the WASM target
3144 - name : Setup Rust Toolchain
32- uses : actions-rs/toolchain@v1.0.6
45+ uses : actions-rs/toolchain@v1
3346 with :
3447 toolchain : stable
3548 target : wasm32-unknown-unknown
3649
50+ # 3. Cache Rust dependencies to speed up future builds
3751 - name : Rust Cache
38- uses : Swatinem/rust-cache@v2.2.1
52+ uses : Swatinem/rust-cache@v2
3953 with :
4054 cache-on-failure : true
4155
42- - name : Setup Dioxus Cli
43- run : |
44- cargo install
45- cargo install dioxus-cli
56+ # 4. Install the Dioxus CLI tool
57+ - name : Setup Dioxus CLI
58+ run : cargo install dioxus-cli --locked
4659
60+ # 5. Build and bundle the Dioxus application
61+ # The `dx bundle` command will create a self-contained `dist` directory
62+ # with all necessary HTML, WASM, and assets.
4763 - name : Build with Dioxus CLI
4864 run : |
49- dx bundle --out-dir prod
50- mv prod/public/* prod
51- cp prod/index.html prod/404.html
52-
53- - name : " Copy CNAME into /prod"
54- run : cp CNAME prod/
55-
65+ dx bundle --release --out-dir dist
66+ # This is a common trick for SPAs on GitHub Pages to handle routing.
67+ # It makes sure that navigating to a non-root URL still serves your app.
68+ cp dist/index.html dist/404.html
69+
70+ # 6. (Optional) Copy CNAME for custom domain
71+ # This step will only run if a CNAME file exists in your repository root.
72+ - name : Copy CNAME for custom domain
73+ if : CNAME
74+ run : cp CNAME dist/
75+
76+ # 7. Configure GitHub Pages
5677 - name : Setup Pages
57- uses : actions/configure-pages@v4
58- with :
59- enablement : true
60- # token:
78+ uses : actions/configure-pages@v5
6179
80+ # 8. Upload the build artifact
81+ # The `dist` directory created by the bundle command is uploaded.
6282 - name : Upload artifact
63- uses : actions/upload-pages-artifact@v4
83+ uses : actions/upload-pages-artifact@v3
6484 with :
65- # Upload prod dir
66- path : ' ./prod'
85+ path : ' ./dist'
6786
87+ # 9. Deploy the artifact to GitHub Pages
6888 - name : Deploy to GitHub Pages 🚀
6989 id : deployment
70- uses : actions/deploy-pages@v3
71-
72-
73-
74-
75- # deploy:
76- # steps:
77- # - name: Checkout
78- # uses: actions/checkout@v3
79- #
80- # - name: Setup TailwindCSS Cli
81- # run: npm -g install tailwindcss
82- #
83- # # - name: Run TailwindCSS Compiler
84- # # run: npx tailwind -c tailwind.config.js -o src/index.css --minify
85- #
86- #
87- # - name: Upload
88- # uses: actions/upload-pages-artifact@v1.0.4
89- # with:
90- # path: dist
91- #
92- # - id: deploy
93- # name: Deploy to GitHub Pages
94- # uses: actions/deploy-pages@v1
95- # with:
96- # token: ${{ github.token }}
90+ uses : actions/deploy-pages@v4
0 commit comments