fix: attempted fix for macos build CI #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Deploy to Cloudflare R2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build-macos: | |
runs-on: macos-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.27.0" | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Build macOS app | |
run: flutter build macos | |
- name: Package macOS app as a zip | |
run: | | |
cd build/macos/Build/Products/Release | |
zip -r "Socket_Probe.zip" "Socket Probe.app" | |
- name: Upload macOS build to Cloudflare R2 (using put-object) | |
env: | |
R2_ACCOUNT_ID: ${{ secrets.R2_ACCOUNT_ID }} | |
R2_BUCKET_NAME: ${{ secrets.R2_BUCKET_NAME }} | |
run: | | |
brew install awscli # Install AWS CLI for macOS | |
aws configure set aws_access_key_id ${{ secrets.R2_ACCESS_KEY_ID }} | |
aws configure set aws_secret_access_key ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
aws configure set default.region auto | |
# Run the put-object command in debug mode | |
aws s3api put-object \ | |
--bucket "${{ secrets.R2_BUCKET_NAME }}" \ | |
--key "macos/Socket_Probe.zip" \ | |
--body "build/macos/Build/Products/Release/Socket_Probe.zip" \ | |
--acl public-read \ | |
--endpoint-url "https://${{ secrets.R2_ACCOUNT_ID }}.r2.cloudflarestorage.com" \ | |
--debug | |
echo "✅ macOS build uploaded!" | |
build-windows: | |
runs-on: windows-latest # ✅ Use Windows runner for Windows builds | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
flutter-version: "3.27.0" | |
- name: Install dependencies | |
run: flutter pub get | |
- name: Build Windows app | |
run: flutter build windows | |
- name: Upload Windows build to Cloudflare R2 | |
run: | | |
choco install awscli # ✅ Install AWS CLI for Windows | |
aws configure set aws_access_key_id ${{ secrets.R2_ACCESS_KEY_ID }} | |
aws configure set aws_secret_access_key ${{ secrets.R2_SECRET_ACCESS_KEY }} | |
aws configure set default.region auto | |
aws s3 cp --endpoint-url=https://$R2_ACCOUNT_ID.r2.cloudflarestorage.com \ | |
build/windows/runner/Release/MyApp.exe s3://${{ secrets.R2_BUCKET_NAME }}/windows/MyApp.exe --acl public-read | |
echo "✅ Windows build uploaded!" | |
generate-links: | |
runs-on: ubuntu-latest # ✅ Use Ubuntu for generating download links | |
steps: | |
- name: Generate Public Links | |
run: | | |
echo "Download macOS App: https://${{ secrets.R2_ACCOUNT_ID }}.r2.dev/${{ secrets.R2_BUCKET_NAME }}/macos/MyApp.dmg" | |
echo "Download Windows App: https://${{ secrets.R2_ACCOUNT_ID }}.r2.dev/${{ secrets.R2_BUCKET_NAME }}/windows/MyApp.exe" |