Example - deploy web on live channel #6
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 live channel | |
on: | |
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: 🏗️ Codegen | |
# run: | | |
# flutter pub global activate intl_utils | |
# flutter pub run build_runner build --delete-conflicting-outputs --release ; \ | |
# flutter pub global run intl_utils:generate | |
# 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 \ | |
--web-renderer canvaskit --base-href / \ | |
--dart-define=ENVIRONMENT=production --dart-define=PROD=true | |
- name: 📁 Upload web build result | |
uses: actions/upload-artifact@v3 | |
with: | |
name: web-live | |
retention-days: 1 | |
if-no-files-found: error | |
path: | | |
example/build/web/ | |
example/.firebaserc | |
example/firebase.json | |
firebase.json | |
# Deploy web on production / live channel | |
web-deploy: | |
name: "Deploy web on live 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-live | |
- name: 📥 List web artifact | |
run: | | |
tree | |
- name: 🔥 Deploy to Firebase live channel | |
uses: FirebaseExtended/action-hosting-deploy@v0 | |
with: | |
repoToken: "${{ secrets.GITHUB_TOKEN }}" | |
firebaseServiceAccount: "${{ secrets.FIREBASE_SERVICE_ACCOUNT_FLUTTER_OCTOPUS_EXAMPLE }}" | |
entryPoint: example/ | |
channelId: live | |
projectId: flutter-octopus-example | |
#target: flutter-octopus-example |