updated README.md #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Flutter CI / Deploy Web | |
| on: | |
| push: | |
| branches: [main] | |
| tags: ['v*.*.*'] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: Build & Test | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| actions: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Cache pub deps | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.pub-cache | |
| key: ${{ runner.os }}-pub-${{ hashFiles('**/pubspec.yaml') }} | |
| restore-keys: ${{ runner.os }}-pub- | |
| - name: Setup Java (Temurin 17) | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '17' | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| channel: stable | |
| flutter-version: 3.35.3 | |
| cache: true | |
| - name: Get dependencies | |
| run: flutter pub get | |
| - name: Run build_runner | |
| run: dart run build_runner build --delete-conflicting-outputs | |
| - name: Analyze Dart code | |
| run: flutter analyze | |
| - name: Run tests | |
| run: flutter test --no-pub --coverage | |
| - name: Build web (release) | |
| run: flutter build web --release --base-href "/" | |
| - name: Upload web artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-build | |
| path: build/web | |
| if-no-files-found: error | |
| deploy: | |
| name: Deploy to GitHub Pages | |
| needs: ci | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| environment: MY_PAT | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Download web artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: web-build | |
| path: build/web | |
| - name: Deploy to VVK027.github.io | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| # PAT needs repo scope on VVK027/VVK027.github.io (Settings → Secrets → MY_PAT) | |
| personal_token: ${{ secrets.MY_PAT }} | |
| external_repository: VVK027/vvk027.github.io | |
| publish_dir: ./build/web | |
| publish_branch: main | |
| - name: Show deployed URL | |
| run: | | |
| echo "### Deployed successfully" >> "$GITHUB_STEP_SUMMARY" | |
| echo "**Live URL:** https://vvk027.github.io/" >> "$GITHUB_STEP_SUMMARY" |