@@ -8,95 +8,105 @@ permissions:
88 contents : write
99
1010jobs :
11- build :
12- name : Build binaries
13- runs-on : ubuntu-latest
14- steps :
15-
16- - name : ' 📄 Checkout'
17- uses : actions/checkout@v4
18-
19- - name : ' 📦 Package windows x64'
20- run : |
21- TAG=${{github.event.release.tag_name}}
22- TAG=${TAG:1}
23- echo "$TAG"
24- cd ${{github.workspace}}
25- dotnet publish TelegramDownloader/TelegramDownloader.csproj -r win-x64 -c Release -o bin/win-x64 -p:PublishSingleFile=true,Version=$TAG --self-contained
26- zip -r TelegramFileManager-${{github.event.release.tag_name}}-win-x64.zip bin/win-x64
27- gh release upload ${{github.event.release.tag_name}} TelegramFileManager-${{github.event.release.tag_name}}-win-x64.zip
28- env :
29- GH_TOKEN : ${{ secrets.TOKENBuild }}
30- shell : bash
31-
32- - name : ' 📦 Package windows x86'
33- run : |
34- TAG=${{github.event.release.tag_name}}
35- TAG=${TAG:1}
36- cd ${{github.workspace}}
37- dotnet publish TelegramDownloader/TelegramDownloader.csproj -r win-x86 -c Release -o bin/win-x86 -p:PublishSingleFile=true,Version=$TAG --self-contained
38- zip -r TelegramFileManager-${{github.event.release.tag_name}}-win-x86.zip bin/win-x86
39- gh release upload ${{github.event.release.tag_name}} TelegramFileManager-${{github.event.release.tag_name}}-win-x86.zip
40- env :
41- GH_TOKEN : ${{ secrets.TOKENBuild }}
42- shell : bash
43-
44- - name : ' 📦 Package windows arm'
45- run : |
46- TAG=${{github.event.release.tag_name}}
47- TAG=${TAG:1}
48- cd ${{github.workspace}}
49- dotnet publish TelegramDownloader/TelegramDownloader.csproj -r win-arm64 -c Release -o bin/win-arm64 -p:PublishSingleFile=true,Version=$TAG --self-contained
50- zip -r TelegramFileManager-${{github.event.release.tag_name}}-win-arm64.zip bin/win-arm64
51- gh release upload ${{github.event.release.tag_name}} TelegramFileManager-${{github.event.release.tag_name}}-win-arm64.zip
52- env :
53- GH_TOKEN : ${{ secrets.TOKENBuild }}
54- shell : bash
55-
56- - name : ' 📦 Package linux x64'
57- run : |
58- TAG=${{github.event.release.tag_name}}
59- TAG=${TAG:1}
60- cd ${{github.workspace}}
61- dotnet publish TelegramDownloader/TelegramDownloader.csproj -r linux-x64 -c Release -o bin/linux-x64 -p:PublishSingleFile=true,Version=$TAG --self-contained
62- zip -r TelegramFileManager-${{github.event.release.tag_name}}-linux-x64.zip bin/linux-x64
63- gh release upload ${{github.event.release.tag_name}} TelegramFileManager-${{github.event.release.tag_name}}-linux-x64.zip
64- env :
65- GH_TOKEN : ${{ secrets.TOKENBuild }}
66- shell : bash
67-
68- - name : ' 📦 Package linux arm'
69- run : |
70- TAG=${{github.event.release.tag_name}}
71- TAG=${TAG:1}
72- cd ${{github.workspace}}
73- dotnet publish TelegramDownloader/TelegramDownloader.csproj -r linux-arm -c Release -o bin/linux-arm -p:PublishSingleFile=true,Version=$TAG --self-contained
74- zip -r TelegramFileManager-${{github.event.release.tag_name}}-linux-arm.zip bin/linux-arm
75- gh release upload ${{github.event.release.tag_name}} TelegramFileManager-${{github.event.release.tag_name}}-linux-arm.zip
76- env :
77- GH_TOKEN : ${{ secrets.TOKENBuild }}
78- shell : bash
79-
80- - name : ' 📦 Package mac OS x64'
81- run : |
82- TAG=${{github.event.release.tag_name}}
83- TAG=${TAG:1}
84- cd ${{github.workspace}}
85- dotnet publish TelegramDownloader/TelegramDownloader.csproj -r osx-x64 -c Release -o bin/osx-x64 -p:PublishSingleFile=true,Version=$TAG --self-contained
86- zip -r TelegramFileManager-${{github.event.release.tag_name}}-osx-x64.zip bin/osx-x64
87- gh release upload ${{github.event.release.tag_name}} TelegramFileManager-${{github.event.release.tag_name}}-osx-x64.zip
88- env :
89- GH_TOKEN : ${{ secrets.TOKENBuild }}
90- shell : bash
91-
92- - name : ' 📦 Package mac OS arm64'
93- run : |
94- TAG=${{github.event.release.tag_name}}
95- TAG=${TAG:1}
96- cd ${{github.workspace}}
97- dotnet publish TelegramDownloader/TelegramDownloader.csproj -r osx-arm64 -c Release -o bin/osx-arm64 -p:PublishSingleFile=true,Version=$TAG --self-contained
98- zip -r TelegramFileManager-${{github.event.release.tag_name}}-osx-arm64.zip bin/osx-arm64
99- gh release upload ${{github.event.release.tag_name}} TelegramFileManager-${{github.event.release.tag_name}}-osx-arm64.zip
100- env :
101- GH_TOKEN : ${{ secrets.TOKENBuild }}
102- shell : bash
11+ build :
12+ name : Build binaries
13+ runs-on : ubuntu-latest
14+ steps :
15+
16+ - name : ' 📄 Checkout'
17+ uses : actions/checkout@v4
18+
19+ - name : ' 🔧 Setup .NET'
20+ uses : actions/setup-dotnet@v4
21+ with :
22+ dotnet-version : ' 10.0.x'
23+
24+ - name : ' 📦 Extract version'
25+ id : version
26+ run : |
27+ TAG=${{github.event.release.tag_name}}
28+ VERSION=${TAG:1}
29+ echo "version=$VERSION" >> $GITHUB_OUTPUT
30+ echo "Building version: $VERSION"
31+
32+ - name : ' 🔨 Build all platforms'
33+ run : |
34+ VERSION=${{ steps.version.outputs.version }}
35+ TAG=${{github.event.release.tag_name}}
36+
37+ echo "Building win-x64..."
38+ dotnet publish TelegramDownloader/TelegramDownloader.csproj -r win-x64 -c Release -o bin/win-x64 -p:PublishSingleFile=true,Version=$VERSION --self-contained
39+
40+ echo "Building win-x86..."
41+ dotnet publish TelegramDownloader/TelegramDownloader.csproj -r win-x86 -c Release -o bin/win-x86 -p:PublishSingleFile=true,Version=$VERSION --self-contained
42+
43+ echo "Building win-arm64..."
44+ dotnet publish TelegramDownloader/TelegramDownloader.csproj -r win-arm64 -c Release -o bin/win-arm64 -p:PublishSingleFile=true,Version=$VERSION --self-contained
45+
46+ echo "Building linux-x64..."
47+ dotnet publish TelegramDownloader/TelegramDownloader.csproj -r linux-x64 -c Release -o bin/linux-x64 -p:PublishSingleFile=true,Version=$VERSION --self-contained
48+
49+ echo "Building linux-arm..."
50+ dotnet publish TelegramDownloader/TelegramDownloader.csproj -r linux-arm -c Release -o bin/linux-arm -p:PublishSingleFile=true,Version=$VERSION --self-contained
51+
52+ echo "Building osx-x64..."
53+ dotnet publish TelegramDownloader/TelegramDownloader.csproj -r osx-x64 -c Release -o bin/osx-x64 -p:PublishSingleFile=true,Version=$VERSION --self-contained
54+
55+ echo "Building osx-arm64..."
56+ dotnet publish TelegramDownloader/TelegramDownloader.csproj -r osx-arm64 -c Release -o bin/osx-arm64 -p:PublishSingleFile=true,Version=$VERSION --self-contained
57+
58+ - name : ' 📦 Create ZIP archives'
59+ run : |
60+ TAG=${{github.event.release.tag_name}}
61+ mkdir -p releases
62+
63+ echo "Creating ZIP archives..."
64+ zip -r releases/TelegramFileManager-${TAG}-win-x64.zip bin/win-x64
65+ zip -r releases/TelegramFileManager-${TAG}-win-x86.zip bin/win-x86
66+ zip -r releases/TelegramFileManager-${TAG}-win-arm64.zip bin/win-arm64
67+ zip -r releases/TelegramFileManager-${TAG}-linux-x64.zip bin/linux-x64
68+ zip -r releases/TelegramFileManager-${TAG}-linux-arm.zip bin/linux-arm
69+ zip -r releases/TelegramFileManager-${TAG}-osx-x64.zip bin/osx-x64
70+ zip -r releases/TelegramFileManager-${TAG}-osx-arm64.zip bin/osx-arm64
71+
72+ echo "Created archives:"
73+ ls -la releases/
74+
75+ - name : ' 🚀 Upload all release assets'
76+ env :
77+ GH_TOKEN : ${{ secrets.TOKENBuild }}
78+ run : |
79+ TAG=${{github.event.release.tag_name}}
80+
81+ # Function to upload with retry
82+ upload_with_retry() {
83+ local file=$1
84+ local max_attempts=5
85+ local attempt=1
86+ local delay=10
87+
88+ while [ $attempt -le $max_attempts ]; do
89+ echo "Uploading $file (attempt $attempt/$max_attempts)..."
90+ if gh release upload "$TAG" "$file" --clobber 2>&1; then
91+ echo "✅ Successfully uploaded $file"
92+ return 0
93+ else
94+ echo "⚠️ Upload failed, waiting ${delay}s before retry..."
95+ sleep $delay
96+ delay=$((delay * 2)) # Exponential backoff
97+ attempt=$((attempt + 1))
98+ fi
99+ done
100+
101+ echo "❌ Failed to upload $file after $max_attempts attempts"
102+ return 1
103+ }
104+
105+ # Upload all files with delays between each
106+ for file in releases/*.zip; do
107+ upload_with_retry "$file"
108+ echo "Waiting 5s before next upload..."
109+ sleep 5
110+ done
111+
112+ echo "✅ All uploads completed!"
0 commit comments