Merge pull request #11 from rydmike/version-2-0-0 #23
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. | |
# Consider setting up a matrix later with beta and dev included too. | |
# - 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. | |
# Controversial, but pub.dev penalizes you if dart format is not used. | |
# - Run all tests with coverage. | |
# - Upload code coverage output to Codecov for analysis. | |
# - Build WEB example app. | |
# Steps: | |
# - Flutter clean. | |
# - Flutter build web app, in release mode and with CanvasKit renderer.# | |
# - Deploy each 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: [published] | |
jobs: | |
flutter_tests: | |
name: "Analyze and test package, then build and deploy web demo" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install Flutter and Dart SDK | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'beta' | |
- 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: "Install 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 . | |
- name: "Test package FlexColorScheme with coverage" | |
run: flutter test --coverage | |
- name: "Upload test coverage to Codecov" | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: coverage/lcov.info | |
# Example Web demo - Build and deploy | |
- name: "EXAMPLE START BUILD - Flutter clean before build" | |
run: flutter clean && cd example && flutter clean | |
- name: "EXAMPLE WEB release build" | |
run: cd example && flutter build web --web-renderer canvaskit --base-href "/flexseedscheme/demo-v2/" --release -t lib/main.dart | |
- name: "EXAMPLE DEPLOY to GitHub Pages repository, published on commit." | |
uses: dmnemec/[email protected] | |
env: | |
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }} | |
with: | |
source_file: 'example/build/web/.' | |
destination_folder: 'flexseedscheme/demo-v2' | |
destination_repo: 'rydmike/rydmike.github.io' | |
user_email: '[email protected]' | |
user_name: 'rydmike' |