-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD: GitHub Actions CI/CD for web build and publish
- Loading branch information
Showing
3 changed files
with
113 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# 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: [none] | ||
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: "EXAMPLE START BUILD - Flutter clean before build" | ||
run: flutter clean | ||
- name: "EXAMPLE WEB release build" | ||
run: flutter build web --web-renderer canvaskit --base-href "/squircle/latest/" --release -t lib/main.dart | ||
- name: "EXAMPLE 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' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This GitHub action is configured to run "on" push to "master". | ||
# Currently, using the "validate" workflow instead, this is an older test CI/CD. | ||
# 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, fails if not. | ||
name: Test | ||
on: | ||
pull_request: | ||
branches: [master] | ||
paths-ignore: | ||
- "**.md" | ||
push: | ||
branches: [none] | ||
paths-ignore: | ||
- "**.md" | ||
jobs: | ||
flutter_test: | ||
name: "Analyze and test package" | ||
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: "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 . | ||
|
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