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
1 -name: Flutter Web 1 +name: deploy web
2 on: 2 on:
3 push: 3 push:
4 branches: 4 branches:
5 - - master 5 + - main
  6 +
6 jobs: 7 jobs:
7 build: 8 build:
8 name: Build Web 9 name: Build Web
9 env: 10 env:
10 my_secret: ${{secrets.commit_secret}} 11 my_secret: ${{secrets.commit_secret}}
  12 + defaults:
  13 + run:
  14 + working-directory: modal_bottom_sheet/example
11 runs-on: ubuntu-latest 15 runs-on: ubuntu-latest
12 steps: 16 steps:
13 - - uses: actions/checkout@v1  
14 - - uses: subosito/flutter-action@v1 17 + - name: 📚 Git Checkout
  18 + uses: actions/checkout@v3
  19 +
  20 + - name: 🐦 Setup Flutter
  21 + uses: subosito/flutter-action@v2
15 with: 22 with:
16 - channel: 'dev'  
17 - - run: |  
18 - cd modal_bottom_sheet/example  
19 - flutter config --enable-web  
20 - flutter pub get  
21 - - run: |  
22 - cd modal_bottom_sheet/example  
23 - flutter build web --release --dart-define=FLUTTER_WEB_USE_SKIA=true  
24 - - run: |  
25 - cd modal_bottom_sheet/example/build/web 23 + cache: true
  24 +
  25 + - name: 📦 Install Dependencies
  26 + run: |
  27 + flutter pub global activate very_good_cli
  28 + very_good --analytics false
  29 + very_good packages get --recursive
  30 +
  31 + - name: 🛠 Build web
  32 + run: flutter build web --dart-define=FLUTTER_WEB_USE_SKIA=true
  33 +
  34 + - name: 🚀 Deploy to github pages
  35 + run: |
  36 + cd build/web
26 git init 37 git init
27 git config --global user.email git@jaimeblasco.com 38 git config --global user.email git@jaimeblasco.com
28 git config --global user.name jamesblasco 39 git config --global user.name jamesblasco
  1 +name: modal_bottom_sheet
  2 +on:
  3 + push:
  4 + branches:
  5 + - main
  6 + pull_request:
  7 + paths:
  8 + - ".github/workflows/modal_bottom_sheet.yaml"
  9 + - "modal_bottom_sheet/**"
  10 +
  11 +jobs:
  12 + build:
  13 + uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/flutter_package.yml@v1
  14 + with:
  15 + working_directory: modal_bottom_sheet
  16 + min_coverage: 0
  17 +
  18 + pana:
  19 + uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
  20 + with:
  21 + working_directory: modal_bottom_sheet
1 -name: Runnable (stable)  
2 -  
3 -on:  
4 - push:  
5 - branches:  
6 - - main  
7 - - master  
8 - pull_request:  
9 - branches:  
10 - - main  
11 - - master  
12 -  
13 -jobs:  
14 - analyze:  
15 - name: Analyze on ${{ matrix.os }}  
16 - runs-on: ${{ matrix.os }}  
17 - strategy:  
18 - matrix:  
19 - os: [ ubuntu-latest ]  
20 - steps:  
21 - - uses: actions/checkout@v1  
22 - - uses: actions/setup-java@v1  
23 - with:  
24 - java-version: '11.x'  
25 - - uses: subosito/flutter-action@v2  
26 - with:  
27 - channel: 'stable'  
28 - - name: Log Dart/Flutter versions  
29 - run: |  
30 - dart --version  
31 - flutter --version  
32 - - name: Prepare dependencies  
33 - run: |  
34 - cd modal_bottom_sheet  
35 - flutter pub get  
36 - - name: Analyse the repo  
37 - run: |  
38 - cd modal_bottom_sheet  
39 - flutter analyze lib  
40 - - name: Run tests  
41 - run: |  
42 - cd modal_bottom_sheet  
43 - flutter test  
  1 +name: sheet - web preview
  2 +on:
  3 + push:
  4 + branches:
  5 + - main
  6 +jobs:
  7 + build_and_deploy:
  8 + defaults:
  9 + run:
  10 + working-directory: sheet/example
  11 + runs-on: ubuntu-latest
  12 + steps:
  13 + - name: 📚 Git Checkout
  14 + uses: actions/checkout@v3
  15 +
  16 + - name: 🐦 Setup Flutter
  17 + uses: subosito/flutter-action@v2
  18 + with:
  19 + cache: true
  20 +
  21 + - name: 📦 Install Dependencies
  22 + run: |
  23 + flutter pub global activate very_good_cli
  24 + very_good --analytics false
  25 + very_good packages get --recursive
  26 +
  27 + - name: 🛠 Build web
  28 + run: flutter build web --dart-define=FLUTTER_WEB_USE_SKIA=true
  29 +
  30 + - name: 🚀 Deploy to firebase hosting
  31 + - uses: FirebaseExtended/action-hosting-deploy@v0
  32 + with:
  33 + repoToken: '${{ secrets.GITHUB_TOKEN }}'
  34 + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SHEET_PREVIEW }}'
  35 + channelId: live
  36 + projectId: sheet-preview
  1 +name: sheet - web preview PR
  2 +on:
  3 + pull_request:
  4 + paths:
  5 + - ".github/workflows/sheet-deploy-web-pull-request.yaml"
  6 + - "sheet/**"
  7 +jobs:
  8 + build_and_preview:
  9 + if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}'
  10 + defaults:
  11 + run:
  12 + working-directory: sheet/example
  13 + runs-on: ubuntu-latest
  14 + steps:
  15 + - name: 📚 Git Checkout
  16 + uses: actions/checkout@v3
  17 +
  18 + - name: 🐦 Setup Flutter
  19 + uses: subosito/flutter-action@v2
  20 + with:
  21 + cache: true
  22 +
  23 + - name: 📦 Install Dependencies
  24 + run: |
  25 + flutter pub global activate very_good_cli
  26 + very_good --analytics false
  27 + very_good packages get --recursive
  28 +
  29 + - name: 🛠 Build web
  30 + run: flutter build web --dart-define=FLUTTER_WEB_USE_SKIA=true
  31 +
  32 + - name: 🚀 Deploy to firebase hosting
  33 + - uses: FirebaseExtended/action-hosting-deploy@v0
  34 + with:
  35 + repoToken: '${{ secrets.GITHUB_TOKEN }}'
  36 + firebaseServiceAccount: '${{ secrets.FIREBASE_SERVICE_ACCOUNT_SHEET_PREVIEW }}'
  37 + projectId: sheet-preview
@@ -2,7 +2,6 @@ name: sheet @@ -2,7 +2,6 @@ name: sheet
2 on: 2 on:
3 push: 3 push:
4 branches: 4 branches:
5 - - master  
6 - main 5 - main
7 pull_request: 6 pull_request:
8 paths: 7 paths:
@@ -19,5 +18,4 @@ jobs: @@ -19,5 +18,4 @@ jobs:
19 pana: 18 pana:
20 uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1 19 uses: VeryGoodOpenSource/very_good_workflows/.github/workflows/pana.yml@v1
21 with: 20 with:
22 - working_directory: sheet  
23 - min_score: 110 # sheet is not in master yet  
  21 + working_directory: sheet
  1 +{
  2 + "projects": {
  3 + "default": "sheet-preview"
  4 + }
  5 +}
  1 +{
  2 + "hosting": {
  3 + "public": "build/web",
  4 + "ignore": [
  5 + "firebase.json",
  6 + "**/.*",
  7 + "**/node_modules/**"
  8 + ],
  9 + "rewrites": [
  10 + {
  11 + "source": "**",
  12 + "destination": "/index.html"
  13 + }
  14 + ]
  15 + }
  16 +}