6666 done
6767 ls -lah
6868
69- - name : Upload macOS artifacts
69+ - name : Upload to R2 (if main/PRODUCTION)
70+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/PRODUCTION'
71+ working-directory : apps/desktop
72+ env :
73+ R2_ACCOUNT_ID : " 9785405a992435bb0c7bd19f9b6d26d5"
74+ R2_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
75+ R2_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
76+ R2_BUCKET : ${{ secrets.R2_BUCKET }}
77+ R2_PUBLIC_URL : ${{ secrets.R2_PUBLIC_URL }}
78+ run : |
79+ VERSION=$(node -p "require('./package.json').version")
80+
81+ if [[ "${{ github.ref }}" == "refs/heads/PRODUCTION" ]]; then
82+ ENV_PREFIX="production"
83+ else
84+ ENV_PREFIX="staging"
85+ fi
86+
87+ brew install rclone
88+
89+ # Configure rclone for R2
90+ mkdir -p ~/.config/rclone
91+ cat > ~/.config/rclone/rclone.conf << EOF
92+ [r2]
93+ type = s3
94+ provider = Cloudflare
95+ access_key_id = ${R2_ACCESS_KEY_ID}
96+ secret_access_key = ${R2_SECRET_ACCESS_KEY}
97+ endpoint = https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com
98+ acl = private
99+ EOF
100+
101+ for file in dist/*.dmg; do
102+ if [ -f "$file" ]; then
103+ filename=$(basename "$file")
104+
105+ echo "📤 Uploading: $filename"
106+
107+ # Upload versioned
108+ rclone copy "$file" "r2:${R2_BUCKET}/desktop/${ENV_PREFIX}/${VERSION}/macos/" \
109+ --progress \
110+ --s3-upload-concurrency 4
111+
112+ # Upload as latest
113+ rclone copy "$file" "r2:${R2_BUCKET}/desktop/${ENV_PREFIX}/latest/macos/" \
114+ --progress \
115+ --s3-upload-concurrency 4
116+
117+ echo "✅ Uploaded: $filename"
118+ echo "🔗 ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/latest/macos/${filename}"
119+ fi
120+ done
121+
122+ - name : Upload macOS artifacts (for GitHub Release)
70123 uses : actions/upload-artifact@v4
71124 with :
72125 name : kortix-macos-${{ matrix.arch }}-${{ github.sha }}
@@ -102,195 +155,73 @@ jobs:
102155 working-directory : apps/desktop
103156 run : dir dist\
104157
105- - name : Upload Windows artifacts
106- uses : actions/upload-artifact@v4
107- with :
108- name : kortix-windows-${{ github.sha }}
109- path : |
110- apps/desktop/dist/*.exe
111- retention-days : 30
112-
113- upload-to-r2 :
114- needs : [build-macos, build-windows]
115- runs-on : ubuntu-latest
116- if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/PRODUCTION'
117- steps :
118- - name : Checkout code
119- uses : actions/checkout@v4
120-
121- - name : Get version from package.json
122- id : version
123- run : |
124- VERSION=$(node -p "require('./apps/desktop/package.json').version")
125- echo "version=$VERSION" >> $GITHUB_OUTPUT
126-
127- - name : Download macOS x64 artifacts
128- uses : actions/download-artifact@v4
129- with :
130- name : kortix-macos-x64-${{ github.sha }}
131- path : ./artifacts/macos-x64
132-
133- - name : Download macOS ARM64 artifacts
134- uses : actions/download-artifact@v4
135- with :
136- name : kortix-macos-arm64-${{ github.sha }}
137- path : ./artifacts/macos-arm64
138-
139- - name : Download Windows artifacts
140- uses : actions/download-artifact@v4
141- with :
142- name : kortix-windows-${{ github.sha }}
143- path : ./artifacts/windows
144-
145- - name : Install AWS CLI
146- run : |
147- curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
148- unzip -q awscliv2.zip
149- sudo ./aws/install --update
150-
151- - name : Upload to Cloudflare R2
158+ - name : Upload to R2 (if main/PRODUCTION)
159+ if : github.ref == 'refs/heads/main' || github.ref == 'refs/heads/PRODUCTION'
160+ working-directory : apps/desktop
161+ shell : bash
152162 env :
153- AWS_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
154- AWS_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
155- R2_ENDPOINT : ${{ secrets.R2_ENDPOINT }}
163+ R2_ACCOUNT_ID : " 9785405a992435bb0c7bd19f9b6d26d5 "
164+ R2_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
165+ R2_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
156166 R2_BUCKET : ${{ secrets.R2_BUCKET }}
157- VERSION : ${{ steps.version.outputs.version }}
167+ R2_PUBLIC_URL : ${{ secrets.R2_PUBLIC_URL }}
158168 run : |
159- # Set environment prefix (staging vs production)
169+ VERSION=$(node -p "require('./package.json').version")
170+
160171 if [[ "${{ github.ref }}" == "refs/heads/PRODUCTION" ]]; then
161172 ENV_PREFIX="production"
162173 else
163174 ENV_PREFIX="staging"
164175 fi
165176
166- echo "📦 Uploading to R2 bucket: $R2_BUCKET"
167- echo "🏷️ Version: $VERSION"
168- echo "🌍 Environment: $ENV_PREFIX"
177+ # Install rclone
178+ curl https://downloads.rclone.org/rclone-current-windows-amd64.zip -o rclone.zip
179+ unzip -q rclone.zip
180+ RCLONE_PATH=$(find . -name "rclone.exe" | head -1)
169181
170- # Upload macOS Intel (x64)
171- for file in ./artifacts/macos-x64/*.dmg; do
172- if [ -f "$file" ]; then
173- filename=$(basename "$file")
174- aws s3 cp "$file" \
175- "s3://$R2_BUCKET/desktop/$ENV_PREFIX/$VERSION/macos/$filename" \
176- --endpoint-url "$R2_ENDPOINT" \
177- --content-type "application/x-apple-diskimage"
178-
179- # Also upload as "latest" for easy access
180- aws s3 cp "$file" \
181- "s3://$R2_BUCKET/desktop/$ENV_PREFIX/latest/macos/$filename" \
182- --endpoint-url "$R2_ENDPOINT" \
183- --content-type "application/x-apple-diskimage"
184-
185- echo "✅ Uploaded macOS x64: $filename"
186- fi
187- done
182+ # Configure rclone for R2
183+ mkdir -p ~/.config/rclone
184+ cat > ~/.config/rclone/rclone.conf << EOF
185+ [r2]
186+ type = s3
187+ provider = Cloudflare
188+ access_key_id = ${R2_ACCESS_KEY_ID}
189+ secret_access_key = ${R2_SECRET_ACCESS_KEY}
190+ endpoint = https://${R2_ACCOUNT_ID}.r2.cloudflarestorage.com
191+ acl = private
192+ EOF
188193
189- # Upload macOS Apple Silicon (ARM64)
190- for file in ./artifacts/macos-arm64/*.dmg; do
194+ for file in dist/*.exe; do
191195 if [ -f "$file" ]; then
192196 filename=$(basename "$file")
193- aws s3 cp "$file" \
194- "s3://$R2_BUCKET/desktop/$ENV_PREFIX/$VERSION/macos/$filename" \
195- --endpoint-url "$R2_ENDPOINT" \
196- --content-type "application/x-apple-diskimage"
197197
198- # Also upload as "latest"
199- aws s3 cp "$file" \
200- "s3://$R2_BUCKET/desktop/$ENV_PREFIX/latest/macos/$filename" \
201- --endpoint-url "$R2_ENDPOINT" \
202- --content-type "application/x-apple-diskimage"
198+ echo "📤 Uploading: $filename"
203199
204- echo "✅ Uploaded macOS ARM64: $filename"
205- fi
206- done
207-
208- # Upload Windows
209- for file in ./artifacts/windows/*.exe; do
210- if [ -f "$file" ]; then
211- filename=$(basename "$file")
212- aws s3 cp "$file" \
213- "s3://$R2_BUCKET/desktop/$ENV_PREFIX/$VERSION/windows/$filename" \
214- --endpoint-url "$R2_ENDPOINT" \
215- --content-type "application/x-msdownload"
200+ # Upload versioned
201+ "$RCLONE_PATH" copy "$file" "r2:${R2_BUCKET}/desktop/${ENV_PREFIX}/${VERSION}/windows/" \
202+ --progress \
203+ --s3-upload-concurrency 4
216204
217- # Also upload as "latest"
218- aws s3 cp "$file" \
219- "s3://$R2_BUCKET/desktop/$ENV_PREFIX/latest/windows/$filename" \
220- --endpoint-url "$R2_ENDPOINT" \
221- --content-type "application/x-msdownload"
205+ # Upload as latest
206+ "$RCLONE_PATH" copy "$file" "r2:${R2_BUCKET}/desktop/${ENV_PREFIX}/latest/windows/" \
207+ --progress \
208+ --s3-upload-concurrency 4
222209
223- echo "✅ Uploaded Windows: $filename"
210+ echo "✅ Uploaded: $filename"
211+ echo "🔗 ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/latest/windows/${filename}"
224212 fi
225213 done
226-
227- echo "🎉 All files uploaded to R2!"
228214
229- - name : Generate download URLs
230- env :
231- R2_PUBLIC_URL : ${{ secrets.R2_PUBLIC_URL }}
232- VERSION : ${{ steps.version.outputs.version }}
233- run : |
234- if [[ "${{ github.ref }}" == "refs/heads/PRODUCTION" ]]; then
235- ENV_PREFIX="production"
236- else
237- ENV_PREFIX="staging"
238- fi
239-
240- echo "## 📥 Download URLs" >> $GITHUB_STEP_SUMMARY
241- echo "" >> $GITHUB_STEP_SUMMARY
242- echo "### Version $VERSION" >> $GITHUB_STEP_SUMMARY
243- echo "" >> $GITHUB_STEP_SUMMARY
244-
245- # List all uploaded files and create URLs
246- for file in ./artifacts/macos-x64/*.dmg; do
247- if [ -f "$file" ]; then
248- filename=$(basename "$file")
249- echo "- **macOS Intel (x64)**: ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/${VERSION}/macos/${filename}" >> $GITHUB_STEP_SUMMARY
250- fi
251- done
252-
253- for file in ./artifacts/macos-arm64/*.dmg; do
254- if [ -f "$file" ]; then
255- filename=$(basename "$file")
256- echo "- **macOS Apple Silicon (ARM64)**: ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/${VERSION}/macos/${filename}" >> $GITHUB_STEP_SUMMARY
257- fi
258- done
259-
260- for file in ./artifacts/windows/*.exe; do
261- if [ -f "$file" ]; then
262- filename=$(basename "$file")
263- echo "- **Windows**: ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/${VERSION}/windows/${filename}" >> $GITHUB_STEP_SUMMARY
264- fi
265- done
266-
267- echo "" >> $GITHUB_STEP_SUMMARY
268- echo "### Latest (always current)" >> $GITHUB_STEP_SUMMARY
269- echo "" >> $GITHUB_STEP_SUMMARY
270-
271- for file in ./artifacts/macos-x64/*.dmg; do
272- if [ -f "$file" ]; then
273- filename=$(basename "$file")
274- echo "- **macOS Intel (x64)**: ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/latest/macos/${filename}" >> $GITHUB_STEP_SUMMARY
275- fi
276- done
277-
278- for file in ./artifacts/macos-arm64/*.dmg; do
279- if [ -f "$file" ]; then
280- filename=$(basename "$file")
281- echo "- **macOS Apple Silicon (ARM64)**: ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/latest/macos/${filename}" >> $GITHUB_STEP_SUMMARY
282- fi
283- done
284-
285- for file in ./artifacts/windows/*.exe; do
286- if [ -f "$file" ]; then
287- filename=$(basename "$file")
288- echo "- **Windows**: ${R2_PUBLIC_URL}/desktop/${ENV_PREFIX}/latest/windows/${filename}" >> $GITHUB_STEP_SUMMARY
289- fi
290- done
215+ - name : Upload Windows artifacts (for GitHub Release)
216+ uses : actions/upload-artifact@v4
217+ with :
218+ name : kortix-windows-${{ github.sha }}
219+ path : |
220+ apps/desktop/dist/*.exe
221+ retention-days : 30
291222
292223 create-release :
293- needs : [build-macos, build-windows, upload-to-r2 ]
224+ needs : [build-macos, build-windows]
294225 runs-on : ubuntu-latest
295226 if : |
296227 github.event_name == 'workflow_dispatch' &&
@@ -377,15 +308,14 @@ jobs:
377308 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
378309
379310 notify :
380- needs : [build-macos, build-windows, upload-to-r2 ]
311+ needs : [build-macos, build-windows]
381312 runs-on : ubuntu-latest
382313 if : always()
383314 steps :
384315 - name : Build Status
385316 run : |
386317 MACOS_STATUS="${{ needs.build-macos.result }}"
387318 WINDOWS_STATUS="${{ needs.build-windows.result }}"
388- R2_STATUS="${{ needs.upload-to-r2.result }}"
389319
390320 echo "## 🏗️ Build Status" >> $GITHUB_STEP_SUMMARY
391321 echo "" >> $GITHUB_STEP_SUMMARY
@@ -406,18 +336,6 @@ jobs:
406336 echo "❌ Windows build failed: $WINDOWS_STATUS"
407337 fi
408338
409- if [ "$R2_STATUS" == "success" ] || [ "$R2_STATUS" == "skipped" ]; then
410- if [ "$R2_STATUS" == "success" ]; then
411- echo "✅ Cloudflare R2 Upload: Success" >> $GITHUB_STEP_SUMMARY
412- echo "✅ Files uploaded to R2!"
413- else
414- echo "⏭️ Cloudflare R2 Upload: Skipped (not main/PRODUCTION branch)" >> $GITHUB_STEP_SUMMARY
415- fi
416- else
417- echo "❌ Cloudflare R2 Upload: $R2_STATUS" >> $GITHUB_STEP_SUMMARY
418- echo "❌ R2 upload failed: $R2_STATUS"
419- fi
420-
421339 if [ "$MACOS_STATUS" == "success" ] && [ "$WINDOWS_STATUS" == "success" ]; then
422340 echo ""
423341 echo "🎉 All desktop builds completed successfully!"
0 commit comments