Skip to content

Commit bf5fdae

Browse files
committed
feat: add GitHub Actions workflow for deploying Flutter web app to GitHub Pages
1 parent cfe8790 commit bf5fdae

File tree

2 files changed

+64
-0
lines changed

2 files changed

+64
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Deploy Flutter Web to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
workflow_dispatch:
7+
8+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
15+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16+
concurrency:
17+
group: "pages"
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
28+
- name: Setup Flutter
29+
uses: subosito/flutter-action@v2
30+
with:
31+
flutter-version: '3.24.5'
32+
channel: 'stable'
33+
34+
- name: Get dependencies
35+
run: flutter pub get
36+
37+
- name: Analyze code
38+
run: flutter analyze
39+
40+
- name: Run tests
41+
run: flutter test
42+
43+
- name: Build web
44+
run: flutter build web --release --base-href /shaders_gallery/
45+
46+
- name: Setup Pages
47+
uses: actions/configure-pages@v5
48+
49+
- name: Upload artifact
50+
uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: ./build/web
53+
54+
deploy:
55+
environment:
56+
name: github-pages
57+
url: ${{ steps.deployment.outputs.page_url }}
58+
runs-on: ubuntu-latest
59+
needs: build
60+
if: github.ref == 'refs/heads/main'
61+
steps:
62+
- name: Deploy to GitHub Pages
63+
id: deployment
64+
uses: actions/deploy-pages@v4

web/.nojekyll

Whitespace-only changes.

0 commit comments

Comments
 (0)