Feature/split by lib #24
Workflow file for this run
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
name: Example - deploy web on preview channel | |
on: | |
pull_request: | |
branches: | |
- "master" | |
- "develop" | |
- "release/**" | |
paths: | |
- "lib/**.dart" | |
- "test/**.dart" | |
- "pubspec.yaml" | |
- "pubspec.lock" | |
workflow_dispatch: | |
jobs: | |
build: | |
#if: '${{ github.event.pull_request.head.repo.full_name == github.repository }}' | |
name: "Build" | |
runs-on: ubuntu-latest | |
container: | |
image: plugfox/flutter:stable-web | |
options: --user root | |
timeout-minutes: 30 | |
env: | |
working-directory: ./example | |
steps: | |
- name: 🚂 Get latest code | |
uses: actions/checkout@v3 | |
- name: 🗄️ Export pub cache directory | |
run: | | |
git config --global --add safe.directory /opt/flutter | |
export PUB_CACHE=$PWD/.pub_cache/ | |
- name: 🚃 Cache pub modules | |
id: cache-pub-modules | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-pub-modules | |
with: | |
key: ${{ runner.os }}-pub-${{ env.cache-name }}-${{ hashFiles('**/pubspec.lock') }} | |
path: | | |
$PWD/.pub_cache/ | |
$PWD/.dart_tool/ | |
$PWD/.flutter-plugins | |
$PWD/.flutter-plugins-dependencies | |
$PWD/.packages | |
- name: 👷 Get dependencies | |
run: | | |
flutter pub get | |
timeout-minutes: 5 | |
- name: 🖼️ Move images from assets to web | |
working-directory: ${{ env.working-directory }} | |
run: | | |
dart run bin/web_move_images.dart | |
timeout-minutes: 5 | |
- name: 🏗️ Codegen | |
working-directory: ${{ env.working-directory }} | |
run: | | |
dart pub global activate intl_utils | |
dart pub global run intl_utils:generate | |
flutter gen-l10n --arb-dir lib/src/common/localization --output-dir lib/src/common/localization/generated --template-arb-file intl_en.arb | |
dart run build_runner build --delete-conflicting-outputs --release | |
timeout-minutes: 5 | |
- name: 🌐 Build flutter web | |
working-directory: ${{ env.working-directory }} | |
run: | | |
flutter build web --release --no-source-maps \ | |
--no-tree-shake-icons --pwa-strategy offline-first \ | |
--base-href / \ | |
--dart-define-from-file=config/staging.json | |
- name: 📁 Upload web build result | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web-preview | |
retention-days: 1 | |
if-no-files-found: error | |
path: | | |
example/build/web/ | |
example/.firebaserc | |
example/firebase.json | |
firebase.json | |
# Deploy web on preview / staging channel | |
web-deploy: | |
name: "Deploy web on preview channel" | |
timeout-minutes: 5 | |
runs-on: ubuntu-latest | |
#defaults: | |
# run: | |
# working-directory: ./example | |
needs: build | |
steps: | |
- name: 📦 Download result for web build job | |
uses: actions/download-artifact@v3 | |
with: | |
name: web-preview | |
- name: 📥 List web artifact | |
run: | | |
tree | |
- name: 🔥 Deploy to Firebase preview channel | |
uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLUTTER_OCTOPUS_EXAMPLE }}" | |
expires: 7d | |
entryPoint: example/ | |
channelId: stage | |
projectId: flutter-octopus-example | |
#target: flutter-octopus-example |