Skip to content

Commit 8760bca

Browse files
committed
ci: set condition for tg upload
Signed-off-by: Burhanverse <contact@burhanverse.eu.org>
1 parent d7050b3 commit 8760bca

File tree

4 files changed

+17
-3
lines changed

4 files changed

+17
-3
lines changed

.github/workflows/build-fagram.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
with:
2828
tagname: ${{ inputs.tagname }}
2929
build_type: ${{ inputs.build_type }}
30+
skip_upload: true
3031
secrets: inherit
3132

3233
build-windows:
@@ -35,6 +36,7 @@ jobs:
3536
with:
3637
tagname: ${{ inputs.tagname }}
3738
build_type: ${{ inputs.build_type }}
39+
skip_upload: true
3840
secrets: inherit
3941

4042
upload-telegram:

.github/workflows/build-linux.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ on:
2626
type: string
2727
required: true
2828
default: "ci"
29+
skip_upload:
30+
description: "Skip Telegram upload"
31+
type: boolean
32+
required: false
33+
default: false
2934

3035
jobs:
3136
build:
@@ -86,6 +91,7 @@ jobs:
8691
upload-telegram:
8792
name: Upload to Telegram
8893
needs: build
94+
if: ${{ !inputs.skip_upload }}
8995
runs-on: ubuntu-latest
9096

9197
steps:

.github/workflows/win-release-x64.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ on:
2626
type: string
2727
required: true
2828
default: "ci"
29+
skip_upload:
30+
description: "Skip Telegram upload"
31+
type: boolean
32+
required: false
33+
default: false
2934

3035
jobs:
3136
prepare-libraries:
@@ -244,7 +249,7 @@ jobs:
244249
upload-telegram:
245250
name: Upload to Telegram
246251
needs: [build-fagram, build-installer]
247-
if: always() && needs.build-installer.result == 'success'
252+
if: ${{ !inputs.skip_upload && needs.build-installer.result == 'success' }}
248253
runs-on: ubuntu-latest
249254

250255
steps:

scripts/tgupload.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ async def upload_single(file, chat_id_list, caption):
3535
async def upload_group(files, chat_id_list, caption):
3636
async with app:
3737
media = []
38+
last_index = len(files) - 1
3839
for i, file in enumerate(files):
3940
media.append(InputMediaDocument(
4041
media=file,
41-
caption=caption if i == 0 else None,
42-
parse_mode=enums.ParseMode.MARKDOWN if i == 0 else None,
42+
caption=caption if i == last_index else None,
43+
parse_mode=enums.ParseMode.MARKDOWN if i == last_index else None,
4344
))
4445
for chat_id in chat_id_list:
4546
await app.send_media_group(chat_id=chat_id, media=media)

0 commit comments

Comments
 (0)