Skip to content

Flutter Web Build and Deploy to Netlify #1

Flutter Web Build and Deploy to Netlify

Flutter Web Build and Deploy to Netlify #1

name: Flutter Web Build and Deploy to Netlify
on:
push:
branches:
- dev
tags:
- '*'
env:
FLUTTER_VERSION: '3.24.3'
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
jobs:
build-and-deploy:
name: Build and Deploy to Netlify
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Cache Flutter SDK and dependencies
uses: actions/cache@v2
with:
path: |
~/.pub-cache
~/.flutter
key: ${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-${{ hashFiles('**/pubspec.yaml') }}
restore-keys: |
${{ runner.os }}-flutter-${{ env.FLUTTER_VERSION }}-
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
- name: Install Dependencies
run: flutter pub get
- name: Build Web
run: flutter build web --release
- name: Deploy to Netlify
uses: nwtgck/[email protected]
with:
publish-dir: './build/web'
production-branch: main
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: false
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1