Jaime Blasco
Committed by GitHub

ci: improve github workflows (#265)

* ci: improve github workflows

* fix: rename file

* fix: add firebase deploy

* fix: only deploy web on merge main

* fix: update names

* fix: trigger typo
name: Flutter Web
name: deploy web
on:
push:
branches:
- master
- main
jobs:
build:
name: Build Web
env:
my_secret: ${{secrets.commit_secret}}
defaults:
run:
working-directory: modal_bottom_sheet/example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: subosito/flutter-action@v1
- name: 📚 Git Checkout
uses: actions/checkout@v3
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'dev'
- run: |
cd modal_bottom_sheet/example
flutter config --enable-web
flutter pub get
- run: |
cd modal_bottom_sheet/example
flutter build web --release --dart-define=FLUTTER_WEB_USE_SKIA=true
- run: |
cd modal_bottom_sheet/example/build/web
cache: true
- name: 📦 Install Dependencies
run: |
flutter pub global activate very_good_cli
very_good --analytics false
very_good packages get --recursive
- name: 🛠 Build web
run: flutter build web --dart-define=FLUTTER_WEB_USE_SKIA=true
- name: 🚀 Deploy to github pages
run: |
cd build/web
git init
git config --global user.email git@jaimeblasco.com
git config --global user.name jamesblasco
... ...
name: modal_bottom_sheet
on:
push:
branches:
- main
pull_request:
paths:
- ".github/workflows/modal_bottom_sheet.yaml"
- "modal_bottom_sheet/**"
jobs:
build:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
with:
working_directory: modal_bottom_sheet
min_coverage: 0
pana:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
with:
working_directory: modal_bottom_sheet
\ No newline at end of file
... ...
name: Runnable (stable)
on:
push:
branches:
- main
- master
pull_request:
branches:
- main
- master
jobs:
analyze:
name: Analyze on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-latest ]
steps:
- uses: actions/checkout@v1
- uses: actions/setup-java@v1
with:
java-version: '11.x'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Log Dart/Flutter versions
run: |
dart --version
flutter --version
- name: Prepare dependencies
run: |
cd modal_bottom_sheet
flutter pub get
- name: Analyse the repo
run: |
cd modal_bottom_sheet
flutter analyze lib
- name: Run tests
run: |
cd modal_bottom_sheet
flutter test
name: sheet - web preview
on:
push:
branches:
- main
jobs:
build_and_deploy:
defaults:
run:
working-directory: sheet/example
runs-on: ubuntu-latest
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v3
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
cache: true
- name: 📦 Install Dependencies
run: |
flutter pub global activate very_good_cli
very_good --analytics false
very_good packages get --recursive
- name: 🛠 Build web
run: flutter build web --dart-define=FLUTTER_WEB_USE_SKIA=true
- name: 🚀 Deploy to firebase hosting
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SHEET_PREVIEW }}'
channelId: live
projectId: sheet-preview
... ...
name: sheet - web preview PR
on:
pull_request:
paths:
- ".github/workflows/sheet-deploy-web-pull-request.yaml"
- "sheet/**"
jobs:
build_and_preview:
if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
defaults:
run:
working-directory: sheet/example
runs-on: ubuntu-latest
steps:
- name: 📚 Git Checkout
uses: actions/checkout@v3
- name: 🐦 Setup Flutter
uses: subosito/flutter-action@v2
with:
cache: true
- name: 📦 Install Dependencies
run: |
flutter pub global activate very_good_cli
very_good --analytics false
very_good packages get --recursive
- name: 🛠 Build web
run: flutter build web --dart-define=FLUTTER_WEB_USE_SKIA=true
- name: 🚀 Deploy to firebase hosting
- uses: FirebaseExtended/action-hosting-deploy@v0
with:
repoToken: '${{ secrets.GITHUB_TOKEN }}'
firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SHEET_PREVIEW }}'
projectId: sheet-preview
... ...
... ... @@ -2,7 +2,6 @@ name: sheet
on:
push:
branches:
- master
- main
pull_request:
paths:
... ... @@ -19,5 +18,4 @@ jobs:
pana:
uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
with:
working_directory: sheet
min_score: 110 # sheet is not in master yet
\ No newline at end of file
working_directory: sheet
\ No newline at end of file
... ...
{
"projects": {
"default": "sheet-preview"
}
}
... ...
{
"hosting": {
"public": "build/web",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}
... ...