Skip to content

Commit cc194c0

Browse files
committed
feat: re-add CI for build creation
1 parent 8aec7e5 commit cc194c0

File tree

1 file changed

+88
-0
lines changed

1 file changed

+88
-0
lines changed

.github/workflows/create_build.yaml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build and Deploy to Cloudflare R2
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-macos:
10+
runs-on: macos-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Setup Flutter
17+
uses: subosito/flutter-action@v2
18+
with:
19+
flutter-version: "3.27.0"
20+
21+
- name: Install dependencies
22+
run: flutter pub get
23+
24+
- name: Build macOS app
25+
run: flutter build macos
26+
27+
- name: Package macOS app as a zip
28+
run: |
29+
cd build/macos/Build/Products/Release
30+
zip -r "Socket_Probe.zip" "Socket Probe.app"
31+
32+
- name: Upload macOS build to Cloudflare R2 (using put-object)
33+
env:
34+
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }}
35+
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }}
36+
run: |
37+
brew install awscli # Install AWS CLI for macOS
38+
aws configure set aws_access_key_id ${{ secrets.R2_ACCESS_KEY_ID }}
39+
aws configure set aws_secret_access_key ${{ secrets.R2_SECRET_ACCESS_KEY }}
40+
aws configure set default.region auto
41+
42+
aws s3api put-object \
43+
--bucket "${{ secrets.R2_BUCKET_NAME }}" \
44+
--key "macos/Socket_Probe.zip" \
45+
--body "build/macos/Build/Products/Release/Socket_Probe.zip" \
46+
--acl public-read \
47+
--endpoint-url "https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com"
48+
49+
echo "✅ macOS build uploaded!"
50+
51+
build-windows:
52+
runs-on: windows-latest # ✅ Use Windows runner for Windows builds
53+
54+
steps:
55+
- name: Checkout code
56+
uses: actions/checkout@v4
57+
58+
- name: Setup Flutter
59+
uses: subosito/flutter-action@v2
60+
with:
61+
flutter-version: "3.27.0"
62+
63+
- name: Install dependencies
64+
run: flutter pub get
65+
66+
- name: Build Windows app
67+
run: flutter build windows
68+
69+
- name: Upload Windows build to Cloudflare R2
70+
run: |
71+
choco install awscli # ✅ Install AWS CLI for Windows
72+
aws configure set aws_access_key_id ${{ secrets.R2_ACCESS_KEY_ID }}
73+
aws configure set aws_secret_access_key ${{ secrets.R2_SECRET_ACCESS_KEY }}
74+
aws configure set default.region auto
75+
76+
aws s3 cp --endpoint-url=https://$R2_ACCOUNT_ID.r2.cloudflarestorage.com \
77+
build/windows/runner/Release/MyApp.exe s3://${{ secrets.R2_BUCKET_NAME }}/windows/MyApp.exe --acl public-read
78+
79+
echo "✅ Windows build uploaded!"
80+
81+
generate-links:
82+
runs-on: ubuntu-latest # ✅ Use Ubuntu for generating download links
83+
84+
steps:
85+
- name: Generate Public Links
86+
run: |
87+
echo "Download macOS App: https://${{ secrets.R2_ACCOUNT_ID }}.r2.dev/${{ secrets.R2_BUCKET_NAME }}/macos/MyApp.dmg"
88+
echo "Download Windows App: https://${{ secrets.R2_ACCOUNT_ID }}.r2.dev/${{ secrets.R2_BUCKET_NAME }}/windows/MyApp.exe"

0 commit comments

Comments
 (0)