-
Notifications
You must be signed in to change notification settings - Fork 0
140 lines (103 loc) · 4.33 KB
/
build_binaries.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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# If branch, build name will be the branch name and the date of the day
# Else if tag, build name will be tag name
# Create an apk of flutter sandbox application when creating a new tag, pushing
# on main branch or making a pull request. This apk will have a build name (the one
# a normal user can see) equal to the date of the day at the format year.month.day.hour
# if it comes from a push on main or a pull request, if the actions come from pushing of
# a tag then it will simply take the name of the tag (tag name must respect format precise
# in the specs : content/docs/sandbox-app/specifications/naming_rules/index.md)
name: Build Binaries
on:
push:
branches: [ "main", "109-hook-windows-installer" ]
tags:
- '*'
pull_request:
branches: [ "main" ]
jobs:
build_apk:
runs-on: ubuntu-latest
steps:
- name: Get tag name
id: tag_name
run: echo "name=$(echo $GITHUB_REF | cut -d / -f 3)" >> $GITHUB_ENV
- name: Get current date
id: date
run: echo "today=$(date +'%Y.%m.%d.%H')" >> $GITHUB_ENV
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.19.0
- run: flutter clean
- run: flutter pub get
- run: flutter pub run flutter_launcher_icons
# If build from tag will use the tag name like build name with these 2 steps
- name: build apk with tag
if: startsWith(github.ref, 'refs/tags/')
run: flutter build apk --build-name ${{ env.name }}
- name: build appbundle with tag
if: startsWith(github.ref, 'refs/tags/')
run: flutter build appbundle --build-name ${{ env.name }}
- name: change apk name with tag name
if: startsWith(github.ref, 'refs/tags/')
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/${{env.name}}.apk
- name: Upload APK
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-artifact@v4
with:
name: apk
path: build/app/outputs/flutter-apk/${{env.name}}.apk
# If build from branch will use the date of the day at the format year.month.day.hour
# like build name with these two next steps
- name: build apk with branch
if: (!startsWith(github.ref, 'refs/tags/'))
run: flutter build apk --build-name ${{ env.today }}
- name: build apk with branch
if: (!startsWith(github.ref, 'refs/tags/'))
run: flutter build appbundle --build-name ${{ env.today }}
- name: change apk name with branch
if: (!startsWith(github.ref, 'refs/tags/'))
run: mv build/app/outputs/flutter-apk/app-release.apk build/app/outputs/flutter-apk/${{env.today}}.apk
- name: Upload APK
if: (!startsWith(github.ref, 'refs/tags/'))
uses: actions/upload-artifact@v4
with:
name: apk
path: build/app/outputs/flutter-apk/${{env.today}}.apk
# build and upload windows app with default name
build_windows_app:
runs-on: windows-latest
steps:
# Get flutter and setup
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.19.0
- run: flutter clean
- run: flutter pub get
- run: flutter pub run flutter_launcher_icons
# Build windows app + upload
- name: build windows app
run: flutter build windows
- name: Upload windows app
uses: actions/upload-artifact@v4
with:
name: windows_app
path: build\windows\x64\runner\Release
# Once binary has been artifacted then we can start workflow of windows installer giving
# binaries of sandbox
- name: Start Windows installer workflow
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.TOKEN_WINDOWS_INSTALLER }}
repository: Panduza/panduza_sandbox_flutter
event-type: update-windows-installer
client-payload: '{"ref": "${{ github.ref }}"}'