-
Notifications
You must be signed in to change notification settings - Fork 1
199 lines (195 loc) · 6.12 KB
/
build.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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Build web app
on:
push:
branches: main
jobs:
build-apk:
name: "[frontend] Android build"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tarok
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v1
with:
java-version: "12.x"
- uses: subosito/flutter-action@v2
with:
channel: beta
- name: Set version number
run: sed -i "s/RELEASE = \"DEBUG\"/RELEASE = \"${GITHUB_SHA}\"/g" lib/constants.dart
- name: Set key.properties
env:
PROPERTIES_PATH: "./android/key.properties"
run: |
echo keyPassword=\${{ secrets.KEY_STORE }} > ${{env.PROPERTIES_PATH}}
echo storePassword=\${{ secrets.KEY_PASSWORD }} >> ${{env.PROPERTIES_PATH}}
echo storeFile=key.jks >> ${{env.PROPERTIES_PATH}}
echo keyAlias=\${{ secrets.KEY_ALIAS }} >> ${{env.PROPERTIES_PATH}}
- name: Decode the keystore
run: echo "${{ secrets.KEYSTORE2 }}" | base64 --decode > android/app/key.jks
- name: Upgrade packages
run: flutter pub upgrade
- name: Build the APK
run: flutter build apk --verbose
- uses: actions/upload-artifact@v3
with:
name: android_app
path: tarok/build/app/outputs/apk/release/app-release.apk
build-windows:
name: "[frontend] Windows build"
runs-on: windows-latest
defaults:
run:
working-directory: ./tarok
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: beta
- run: git config --system core.longpaths true && flutter pub upgrade
- run: flutter pub get
- run: flutter config --enable-windows-desktop
- run: flutter doctor --verbose
- run: flutter devices
- run: flutter build windows --verbose
- uses: actions/upload-artifact@v3
with:
name: windows_app
path: tarok/build/windows/x64/runner/Release
build-linux:
name: "[frontend] Linux build"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tarok
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: beta
- name: Install build dependencies
run: |
sudo apt-get update -y
sudo apt-get install -y ninja-build libgtk-3-dev libsecret-1-dev libjsoncpp-dev libmpv-dev mpv
- name: Set version number
run: sed -i "s/RELEASE = \"DEBUG\"/RELEASE = \"${GITHUB_SHA}\"/g" lib/constants.dart
- name: Get dependencies
run: flutter pub upgrade
- name: Enable Linux desktop for building
run: flutter config --enable-linux-desktop
- name: Run flutter doctor for inspection
run: flutter doctor -v
- name: Run flutter devices for getting all devices info
run: flutter devices
- name: Build Linux app
run: flutter build linux --verbose
- run: ls build/linux/x64/release/bundle
- uses: actions/upload-artifact@v3
with:
name: linux_app
path: tarok/build/linux/x64/release/bundle
build-web:
name: "[frontend] JavaScript build"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./tarok
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
with:
channel: beta
- name: Set version number
run: sed -i "s/RELEASE = \"DEBUG\"/RELEASE = \"${GITHUB_SHA}\"/g" lib/constants.dart
- run: flutter pub upgrade
- run: flutter build web --verbose
- uses: actions/upload-artifact@v3
with:
name: web_app
path: tarok/build/web
build-web-docker:
name: "[frontend] JavaScript container build"
needs: build-web
runs-on: ubuntu-latest
steps:
- name: Get Docker version
run: docker --version
- name: Docker Login
uses: docker/login-action@v1
with:
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
registry: "ghcr.io"
- name: Build Docker image
uses: docker/build-push-action@v2
with:
file: "./tarok/Dockerfile"
tags: ghcr.io/mytja/tarok/frontend:latest
push: true
stockskis-cli-linux:
name: "[stockskis_cli] Linux build"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./stockskis_cli
steps:
- uses: actions/checkout@v3
- uses: dart-lang/setup-dart@v1
- name: Pull StockŠkis dependencies
run: dart pub get
- name: Build StockŠkis & StockŠkis CLI
run: ./build.sh
- uses: actions/upload-artifact@v3
with:
name: stockskis-cli-linux
path: backend/stockskis
server-build-linux:
name: "[backend] Linux build"
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v2
with:
go-version: "^1.20"
- name: Install packages
run: sudo apt update -y && sudo apt install -y libvips-dev libvips
- name: Get current Go version
run: go version
- name: Get Go dependencies
run: go mod download
- name: Set env
run: go env -w GOFLAGS=-mod=mod
- name: Build app
run: go build -v -o backend .
- uses: actions/upload-artifact@v3
with:
name: backend-linux
path: backend/backend
server-docker:
name: "[backend] Linux container build"
needs:
- server-build-linux
- stockskis-cli-linux
runs-on: ubuntu-latest
steps:
- name: List files
run: ls -la
- name: Get Docker version
run: docker --version
- name: Docker Login
uses: docker/login-action@v1
with:
username: ${{github.actor}}
password: ${{secrets.GITHUB_TOKEN}}
registry: "ghcr.io"
- name: Build Docker image
uses: docker/build-push-action@v2
with:
file: "./backend/Dockerfile"
tags: ghcr.io/mytja/tarok/backend:latest
push: true