-
Notifications
You must be signed in to change notification settings - Fork 0
310 lines (275 loc) · 10.8 KB
/
update-fork.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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
name: Sync, Build, and Release
on:
schedule:
- cron: '0 * * * *' # Запуск каждый час
workflow_dispatch: # Возможность ручного запуска
jobs:
sync:
runs-on: ubuntu-latest
outputs:
run_build: ${{ steps.sync_upstream.outputs.run_build }}
timestamp: ${{ steps.generate_timestamp.outputs.timestamp }}
steps:
# 1. Генерируем TIMESTAMP
- name: Generate Timestamp
id: generate_timestamp
run: |
TIMESTAMP=$(date +"%Y%m%d-%H%M")
echo "timestamp=$TIMESTAMP" >> $GITHUB_OUTPUT
# 2. Клонируем форк
- name: Checkout Fork
uses: actions/checkout@v3
with:
repository: nix155/qdomyos-zwift
token: ${{ secrets.PAT_TOKEN }}
fetch-depth: 0
# 2. Настраиваем Upstream и синхронизируем с оригиналом
- name: Sync with Upstream
id: sync_upstream
run: |
git remote add upstream https://github.com/cagnulein/qdomyos-zwift.git
git fetch upstream
if git diff --quiet HEAD upstream/master; then
echo "run_build=false" >> $GITHUB_OUTPUT
else
echo "run_build=true" >> $GITHUB_OUTPUT
git merge upstream/master --no-edit
git push origin master
fi
# echo "run_build=false" >> $GITHUB_OUTPUT
# if ! git diff --quiet HEAD upstream/master; then
# if ! git diff --quiet HEAD upstream/master -- src; then
# echo "run_build=true" >> $GITHUB_OUTPUT
# fi
# git merge upstream/master --no-edit
# git push origin master
# fi
build:
runs-on: ubuntu-latest
needs: sync
if: ${{ needs.sync.outputs.run_build == 'true' }}
steps:
# 1. Клонируем оригинал
- name: Checkout Original Repository
uses: actions/checkout@v3
with:
repository: cagnulein/qdomyos-zwift
fetch-depth: 0
# 2. Устанавливаем зависимости
- name: Install Dependencies
run: |
sudo apt update -y
sudo apt install --no-install-recommends -y \
git \
ca-certificates \
qtquickcontrols2-5-dev \
qtconnectivity5-dev \
qtbase5-private-dev \
qtpositioning5-dev \
libqt5charts5-dev \
libqt5networkauth5-dev \
libqt5websockets5-dev \
qml-module* \
libqt5texttospeech5-dev \
qtlocation5-dev \
qtmultimedia5-dev \
g++ \
make \
wget \
unzip
# 3. Обновляем подмодули и компилируем проект
- name: Build Binary
run: |
git submodule update --init src/smtpclient/
git submodule update --init src/qmdnsengine/
git submodule update --init tst/googletest/
pushd src
qmake qdomyos-zwift.pro
make -j$(nproc)
popd
# 4. Упаковываем бинарник с добавлением даты
- name: Package Binary
run: |
mkdir -p dist
BIN_NAME="qdomyos-zwift-${{ needs.sync.outputs.timestamp }}.tar.gz"
ARC_PATH="dist/$BIN_NAME"
echo "BIN_NAME=$BIN_NAME" >> $GITHUB_ENV
echo "ARC_PATH=$ARC_PATH" >> $GITHUB_ENV
tar -czvf "$ARC_PATH" -C src qdomyos-zwift
echo "ls -lah src/" && ls -lah src/
echo "ls -lah dist/" && ls -lah dist/
# 5. Создаём релиз и публикуем упакованный бинарник
- name: Create Release
id: create_release
uses: actions/create-release@v1
with:
tag_name: ${{ needs.sync.outputs.timestamp }}
release_name: "Release ${{ needs.sync.outputs.timestamp }}"
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
# 6. Загружаем артефакт в релиз
- name: Upload Release Asset
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ env.ARC_PATH }}
asset_name: ${{ env.BIN_NAME }}
asset_content_type: application/gzip
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
build-push-dh-webgl:
needs: sync
if: ${{ needs.sync.outputs.run_build == 'never' }}
uses: ./.github/workflows/build-push-dh.yml
with:
repository: cagnulein/qdomyos-zwift
dockerfile: docker/linux_webgl/Dockerfile
image_name: qdomyos-zwift-webgl
timestamp: ${{ needs.sync.outputs.timestamp }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_NAMESPACE: ${{ secrets.DOCKER_NAMESPACE }}
build-push-dh-gui-vnc:
needs: sync
if: ${{ needs.sync.outputs.run_build == 'never' }}
uses: ./.github/workflows/build-push-dh.yml
with:
repository: cagnulein/qdomyos-zwift
dockerfile: docker/linux_gui_vnc/Dockerfile
image_name: qdomyos-zwift-gui-vnc
timestamp: ${{ needs.sync.outputs.timestamp }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
DOCKER_NAMESPACE: ${{ secrets.DOCKER_NAMESPACE }}
build-push-gh-webgl:
needs: sync
if: ${{ needs.sync.outputs.run_build == 'true' }}
uses: ./.github/workflows/build-push-gh.yml
with:
repository: cagnulein/qdomyos-zwift
dockerfile: docker/linux_webgl/Dockerfile
image_name: qdomyos-zwift-webgl
timestamp: ${{ needs.sync.outputs.timestamp }}
secrets:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
build-push-gh-gui-vnc:
needs: sync
if: ${{ needs.sync.outputs.run_build == 'true' }}
uses: ./.github/workflows/build-push-gh.yml
with:
repository: cagnulein/qdomyos-zwift
dockerfile: docker/linux_gui_vnc/Dockerfile
image_name: qdomyos-zwift-gui-vnc
timestamp: ${{ needs.sync.outputs.timestamp }}
secrets:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
notify:
runs-on: ubuntu-latest
needs: sync
if: ${{ needs.sync.outputs.run_build == 'true' }}
steps:
- name: Send Telegram Notification
run: |
curl -X POST https://api.telegram.org/bot${{ secrets.TELEGRAM_TOKEN }}/sendMessage \
-d chat_id=${{ secrets.TELEGRAM_CHAT_ID }} \
-d text="Новая сборка ${{ needs.sync.outputs.timestamp }} в репозитории ${{ github.repository }}"
# build-push-dh-webgl:
# runs-on: ubuntu-latest
# if: ${{ needs.sync.outputs.run_build == 'never' }}
# needs: sync
# steps:
# # 1. Клонируем оригинал
# - name: Checkout Original Repository
# uses: actions/checkout@v3
# with:
# repository: cagnulein/qdomyos-zwift
# fetch-depth: 0
# # 2. Логинимся в DockerHub
# - name: Log in to DockerHub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# # 3. Сборка и пуш WebGL-образа
# - name: Build and Push WebGL Image
# run: |
# TIMESTAMP=${{ needs.sync.outputs.timestamp }}
# IMAGE_NAME="${{ secrets.DOCKER_NAMESPACE }}/qdomyos-zwift-webgl"
# docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$TIMESTAMP -f docker/linux_webgl/Dockerfile .
# docker push $IMAGE_NAME:latest
# docker push $IMAGE_NAME:$TIMESTAMP
# build-push-dh-gui-vnc:
# runs-on: ubuntu-latest
# if: ${{ needs.sync.outputs.run_build == 'never' }}
# needs: sync
# steps:
# # 1. Клонируем оригинал
# - name: Checkout Original Repository
# uses: actions/checkout@v3
# with:
# repository: cagnulein/qdomyos-zwift
# fetch-depth: 0
# # 2. Логинимся в DockerHub
# - name: Log in to DockerHub
# uses: docker/login-action@v2
# with:
# username: ${{ secrets.DOCKER_USERNAME }}
# password: ${{ secrets.DOCKER_PASSWORD }}
# # 3. Сборка и пуш GUI VNC-образа
# - name: Build and Push GUI VNC Image
# run: |
# TIMESTAMP=${{ needs.sync.outputs.timestamp }}
# IMAGE_NAME="${{ secrets.DOCKER_NAMESPACE }}/qdomyos-zwift-gui-vnc"
# docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$TIMESTAMP -f docker/linux_gui_vnc/Dockerfile .
# docker push $IMAGE_NAME:latest
# docker push $IMAGE_NAME:$TIMESTAMP
# build-push-gh-webgl:
# runs-on: ubuntu-latest
# if: ${{ needs.sync.outputs.run_build == 'true' }}
# needs: sync
# permissions: write-all
# steps:
# # 1. Клонируем оригинал
# - name: Checkout Original Repository
# uses: actions/checkout@v3
# with:
# repository: cagnulein/qdomyos-zwift
# fetch-depth: 0
# # 2. Логинимся в GHCR
# - name: Log in to GitHub Container Registry
# run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# # 3. Сборка и пуш WebGL-образа
# - name: Build and Push WebGL Image
# run: |
# TIMESTAMP=${{ needs.sync.outputs.timestamp }}
# IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/qdomyos-zwift-webgl"
# docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$TIMESTAMP -f docker/linux_webgl/Dockerfile .
# docker push $IMAGE_NAME:latest
# docker push $IMAGE_NAME:$TIMESTAMP
# build-push-gh-gui-vnc:
# runs-on: ubuntu-latest
# if: ${{ needs.sync.outputs.run_build == 'true' }}
# needs: sync
# permissions: write-all
# steps:
# # 1. Клонируем оригинал
# - name: Checkout Original Repository
# uses: actions/checkout@v3
# with:
# repository: cagnulein/qdomyos-zwift
# fetch-depth: 0
# # 2. Логинимся в GHCR
# - name: Log in to GitHub Container Registry
# run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
# # 3. Сборка и пуш GUI VNC-образа
# - name: Build and Push GUI VNC Image
# run: |
# TIMESTAMP=${{ needs.sync.outputs.timestamp }}
# IMAGE_NAME="ghcr.io/${{ github.repository_owner }}/qdomyos-zwift-gui-vnc"
# docker build -t $IMAGE_NAME:latest -t $IMAGE_NAME:$TIMESTAMP -f docker/linux_gui_vnc/Dockerfile .
# docker push $IMAGE_NAME:latest
# docker push $IMAGE_NAME:$TIMESTAMP