@@ -192,53 +192,65 @@ jobs:
192192 echo "📊 File sizes:"
193193 find ./artifacts -name "*.exe" -o -name "*.dmg" -o -name "*.AppImage" -o -name "*.zip" -exec ls -lh {} \;
194194
195- - name : Check if release exists and delete it
195+ - name : Install GitHub CLI
196+ run : |
197+ curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
198+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
199+ sudo apt update && sudo apt install gh -y
200+
201+ - name : Delete existing release (if any)
202+ run : |
203+ # Silently delete if exists, ignore if doesn't
204+ gh release delete "${{ github.ref_name }}" --yes 2>/dev/null || true
205+ echo "✅ Cleaned up any existing release"
196206 env :
197207 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
208+
209+ - name : Create GitHub Release
198210 run : |
199- echo "🔍 Checking for release with tag: ${{ github.ref_name }}"
211+ # Create the release first
212+ gh release create "${{ github.ref_name }}" \
213+ --title "Ori Launcher ${{ github.ref_name }}" \
214+ --notes-file <(echo "Automated release of Ori Launcher ${{ github.ref_name }}") \
215+ --generate-notes
200216
201- # Check if release exists for the CURRENT tag
202- response=$(curl -s -o /dev/null -w "%{http_code}" \
203- -H "Authorization: token $GITHUB_TOKEN" \
204- -H "Accept: application/vnd.github.v3+json" \
205- "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}")
217+ echo "✅ Release created successfully"
218+ env :
219+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
220+
221+ - name : Upload release assets
222+ run : |
223+ # Upload each main installer file individually
224+ echo "📤 Uploading release assets..."
206225
207- echo "Release check HTTP status: $response"
226+ # Windows installer
227+ WINDOWS_EXE=$(find ./artifacts -name "*.exe" -not -path "*/win-unpacked/*" | head -1)
228+ if [ -f "$WINDOWS_EXE" ]; then
229+ echo "⬆️ Uploading Windows installer..."
230+ gh release upload "${{ github.ref_name }}" "$WINDOWS_EXE" --clobber
231+ fi
208232
209- # If release exists (200), delete it
210- if [ "$response" = "200" ]; then
211- echo "🗑️ Deleting existing release for tag: ${{ github.ref_name }}..."
212- curl -X DELETE \
213- -H "Authorization: token $GITHUB_TOKEN" \
214- -H "Accept: application/vnd.github.v3+json" \
215- "https://api.github.com/repos/${{ github.repository }}/releases/tags/${{ github.ref_name }}"
216- echo "✅ Release deleted"
217-
218- # Wait a bit longer for GitHub to process
219- sleep 10
220- else
221- echo "✅ No existing release found for tag: ${{ github.ref_name }} (status: $response)"
233+ # macOS .dmg
234+ MAC_DMG=$(find ./artifacts -name "*.dmg" | head -1)
235+ if [ -f "$MAC_DMG" ]; then
236+ echo "⬆️ Uploading macOS .dmg..."
237+ gh release upload "${{ github.ref_name }}" "$MAC_DMG" --clobber
222238 fi
223-
224- - name : Prepare clean artifact paths
225- run : |
226- # Create a clean directory with only the main distributables
227- mkdir -p release-files
228239
229- # Copy only the main installer files, not unpacked contents
230- find ./artifacts -name "*.exe" -not -path "*/win-unpacked/*" -exec cp {} release-files/ \;
231- find ./artifacts -name "*.dmg" -exec cp {} release-files/ \;
232- find ./artifacts -name "*.AppImage" -exec cp {} release-files/ \;
233- find ./artifacts -name "*.zip" -exec cp {} release-files/ \;
240+ # macOS .zip (optional - skip if problematic)
241+ MAC_ZIP=$(find ./artifacts -name "*.zip" | head -1)
242+ if [ -f "$MAC_ZIP" ]; then
243+ echo "⬆️ Uploading macOS .zip..."
244+ gh release upload "${{ github.ref_name }}" "$MAC_ZIP" --clobber || echo "⚠️ Skipped .zip upload"
245+ fi
234246
235- echo "🎯 Release files prepared:"
236- ls -la release-files/
237-
238- - name : Create GitHub Release
239- uses : softprops/action-gh- release@v1
240- with :
241- files : release-files/*
242- generate_release_notes : true
243- draft : false
244- prerelease : false
247+ # Linux AppImage
248+ LINUX_APPIMAGE=$(find ./artifacts -name "*.AppImage" | head -1)
249+ if [ -f "$LINUX_APPIMAGE" ]; then
250+ echo "⬆️ Uploading Linux AppImage..."
251+ gh release upload "${{ github.ref_name }}" "$LINUX_APPIMAGE" --clobber
252+ fi
253+
254+ echo "✅ All assets uploaded successfully!"
255+ env :
256+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments