Try CI/CD web build again #2
This file contains 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
# This GitHub action runs on a release, when the GitHub repo is "published". | |
# This workflow: | |
# - Installs dart and flutter | |
# - Uses flutter stable channel. | |
# - Enables flutter web | |
# - Gets package dependencies | |
# - Runs dart analyze. | |
# - Show outdated packages, just added for info. | |
# - Verify that dart format is used by all committed code, fail if not. | |
# - Build WEB example app. | |
# Steps: | |
# - Flutter clean. | |
# - Flutter build web app, in release mode and with CanvasKit renderer.# | |
# - Deploy built Web App to GitHub pages. | |
name: Deploy | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- "**.md" | |
pull_request: | |
branches: [none] | |
paths-ignore: | |
- "**.md" | |
release: | |
branches: [master] | |
types: [publish] | |
jobs: | |
flutter_tests: | |
name: "Analyze app, then build and deploy web version" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Flutter and Dart SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: "Show Dart SDK version" | |
run: dart --version | |
- name: "Show Flutter SDK version" | |
run: flutter --version | |
- name: "Flutter Enable Web" | |
run: flutter config --enable-web | |
- name: "Get Flutter package dependencies" | |
run: flutter pub get | |
- name: "Analyze Dart source" | |
run: dart analyze | |
- name: "Show outdated packages" | |
run: flutter pub outdated | |
- name: "Verify that Dart formatting is used, fail if not" | |
run: dart format --output=none --set-exit-if-changed . | |
# Web - Build and deploy | |
- name: "START BUILD - Flutter clean before build" | |
run: flutter clean | |
- name: "WEB release build" | |
run: flutter build web --web-renderer canvaskit --base-href "/squircle/latest/" --release -t lib/main.dart | |
- name: "DEPLOY to GitHub Pages repository, published on commit." | |
uses: dmnemec/copy_file_to_another_repo_action@v1.0.4 | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source_file: 'build/web/.' | |
destination_folder: 'squircle/latest' | |
destination_repo: 'rydmike/rydmike.github.io' | |
user_email: 'm.rydstrom@gmail.com' | |
user_name: 'rydmike' |