Skip to content

Add sed command to replace $FLUTTER_BASE_HREF with '/' (#7) #10

Add sed command to replace $FLUTTER_BASE_HREF with '/' (#7)

Add sed command to replace $FLUTTER_BASE_HREF with '/' (#7) #10

name: Build and deploy on GitHub Pages
on:
workflow_dispatch:
push:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter pub get
- run: flutter test
- run: flutter build web
- name: Update base href for GitHub Pages
run: sed -i 's|\$FLUTTER_BASE_HREF|/|' build/web/index.html
- name: Copy index.html to 404.html
run: cp build/web/index.html build/web/404.html
- uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: gh-pages
build_dir: build/web
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}