-
Notifications
You must be signed in to change notification settings - Fork 87
62 lines (59 loc) · 1.63 KB
/
web.yml
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: web
on:
# Triggers workflow on PR but only for main branch
push:
branches: [ main ]
# for release
tags:
- "v*.*.*"
pull_request:
branches: [ main ]
# Allows manual trigger from Actions tab
workflow_dispatch:
jobs:
build-web:
permissions: write-all
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./flutter
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
flutter-version: '3.19.2'
cache: true
channel: 'stable'
- run: flutter doctor -v
- run: flutter analyze
- run: flutter pub get
- run: flutter test
- name: Build and zip
run: |
flutter build web --dart-define-from-file=env.json
cd ./build/web
zip -r ../web.zip .
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
flutter/build/web.zip
draft: true
fail_on_unmatched_files: true
- name: Deploy to Netlify
uses: nwtgck/[email protected]
if: github.event_name == 'pull_request'
with:
publish-dir: './flutter/build/web'
production-branch: main
alias: ${{ github.sha }}
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: true
enable-commit-comment: true
overwrites-pull-request-comment: false
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1