Home [Flutter] Deploy netlify
Post
Cancel

[Flutter] Deploy netlify

1
flutter build web

build/web에 결과가 나오고, 결과 파일을 netlify에 업로드해도 가능

github action을 활용

  • github token 발급
  • netlify auth token, site id
  • github settings에 sercrets 추가
  • .github/workflow/deploy.yml 작성 (프로젝트 ROOT에 작성)
    • run cd frontend; flutter config --enable-web; flutter build web
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# .github/workflows/netlify.yml
name: Build and Deploy to Netlify
on:
  push:
    branches: [main]
  pull_request:
    branches: [main]
jobs:
  build:
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v2
      - uses: subosito/flutter-action@v1
        with:
          channel: beta
      - run: cd frontend; flutter config --enable-web; flutter build web --web-renderer html --release

      - name: Deploy to Netlify
        uses: nwtgck/actions-netlify@v1.2
        with:
          publish-dir: './frontend/build/web'
          production-branch: main
          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: $
          NETLIFY_SITE_ID: $
        timeout-minutes: 1

참고

This post is licensed under CC BY 4.0 by the author.

[Flutter] Tutorial

[Flutter] Fetch Data