Skip to content

Commit cfcf87b

Browse files
ci: improve pipelines to deploy to github pages
1 parent acd88b6 commit cfcf87b

File tree

2 files changed

+39
-1
lines changed

2 files changed

+39
-1
lines changed

.github/workflows/build-examples.yaml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,12 @@ jobs:
4040
run: |
4141
flutter build appbundle --debug
4242
flutter build ios --debug --no-codesign
43-
flutter build web
43+
flutter build web --base-href "/${{ github.event.repository.name }}_website/"
4444
flutter build macos
45+
- name: Archive web artifacts
46+
if: ${{ github.ref_type == 'tag' }}
47+
uses: actions/upload-artifact@v4
48+
with:
49+
name: web-app
50+
path: example/build/web/
51+
retention-days: 1

.github/workflows/deployment.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,34 @@ jobs:
2727
cache-key: "flutter-:os:-:channel:-:version:"
2828
- name: Publish package
2929
run: dart pub publish -v -f
30+
- name: Release
31+
uses: softprops/action-gh-release@v2
32+
with:
33+
generate_release_notes: true
34+
deployment-web:
35+
if: ${{ github.ref_type == 'tag' }}
36+
name: Deploy example to website
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Configure enviroment
40+
uses: actions/checkout@v4
41+
with:
42+
fetch-depth: 1 # Use shallow clone for faster checkout
43+
- uses: actions/download-artifact@v4
44+
with:
45+
name: web-app
46+
path: example/build/web
47+
- name: HTML/CSS/JS Minifier
48+
uses: docker://devatherock/minify-js:3.1.0
49+
with:
50+
directory: 'example/build/webb'
51+
add_suffix: false
52+
- name: Upload to GitHub Pages
53+
uses: peaceiris/actions-gh-pages@v4
54+
with:
55+
github_token: ${{ secrets.GITHUB_TOKEN }}
56+
publish_dir: example/build/web
57+
publish_branch: main
58+
commit_message: "Deploying version ${{ github.event.release.tag_name }}"
59+
cname: flutterformbuilderecosystem.com
60+
external_repository: "flutter-form-builder-ecosystem/${{ github.event.repository.name }}_website"

0 commit comments

Comments
 (0)