Skip to content

Commit d83d913

Browse files
authored
Merge pull request #2 from ikhsan3adi/github-pages
Github pages flutter web
2 parents 4b04b60 + f1d1c7e commit d83d913

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

.github/workflows/gh-pages.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Github Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- master
8+
pull_request:
9+
10+
jobs:
11+
deploy:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup Flutter
21+
run: |
22+
git clone https://github.com/flutter/flutter.git --depth 1 -b stable _flutter
23+
echo "${GITHUB_WORKSPACE}/_flutter/bin" >> ${GITHUB_PATH}
24+
25+
- name: Install
26+
run: |
27+
flutter config --enable-web
28+
flutter pub get
29+
30+
- name: Build
31+
run: flutter build web --base-href "/${{ github.event.repository.name }}/"
32+
33+
- name: Deploy
34+
uses: peaceiris/actions-gh-pages@v4
35+
if: github.ref == 'refs/heads/main'
36+
with:
37+
github_token: ${{ secrets.GITHUB_TOKEN }}
38+
publish_dir: ./build/web
39+
40+
- name: Deploy (Test)
41+
uses: peaceiris/actions-gh-pages@v4
42+
if: github.ref != 'refs/heads/main'
43+
with:
44+
github_token: ${{ secrets.GITHUB_TOKEN }}
45+
publish_dir: ./build/web
46+
publish_branch: gh-pages-test

0 commit comments

Comments
 (0)