-
Notifications
You must be signed in to change notification settings - Fork 6
119 lines (100 loc) · 3.01 KB
/
dart.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
name: Build Android App
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
workflow_dispatch:
release:
types: [released]
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Run tests
run: flutter test
build:
name: Build
needs: [test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
channel: 'stable'
- name: Install dependencies
run: flutter pub get
- name: Build APK
run: |
flutter build apk --release
- name: Print Folder Tree
uses: jaywcjlove/github-action-folder-tree@main
with:
exclude: "node_modules|dist|.git|.husky"
path: ./build
depth: 10
- name: Upload APK
uses: actions/upload-artifact@v4
with:
name: android-release
path: build/app/outputs/flutter-apk/app-release.apk
release:
name: Release
needs: [build]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Tag the repository (pre-release)
if: github.event_name != 'release' || github.event.action != 'created'
id: tag
run: |
TAG=nightly.$(date -Iseconds | sed 's/[T:\+]/-/g')
TIME=$(date '+%Y/%m/%d %H:%M')
echo "$TAG"
echo "tag=$TAG" >> $GITHUB_OUTPUT
echo "time=$TIME" >> $GITHUB_OUTPUT
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
git tag -a $TAG -m "Published version $TAG" ${GITHUB_SHA}
git push origin $TAG
- name: Download artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Create release (pre-release)
uses: softprops/action-gh-release@v2
if: github.event_name != 'release' || github.event.action != 'created'
with:
files: artifacts/*/*
prerelease: true
make_latest: false
tag_name: ${{ steps.tag.outputs.tag }}
name: ${{ steps.tag.outputs.time }}
- name: Create release (release)
uses: softprops/action-gh-release@v2
if: github.event_name == 'release' && github.event.action == 'created'
with:
files: artifacts/*/*
prerelease: false
make_latest: true