Skip to content

Commit 31303e7

Browse files
Merge pull request #9 from TheCodeDaniel/feat/ci_and_builds
feat: setup CI files for deployment
2 parents de3d46e + 73d6924 commit 31303e7

File tree

3 files changed

+79
-0
lines changed

3 files changed

+79
-0
lines changed

.github/ci.yaml

Whitespace-only changes.

.github/workflows/ci.yaml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: CI
2+
on:
3+
pull_request:
4+
branches:
5+
- main
6+
7+
jobs:
8+
flutter_test:
9+
name: Run flutter test and analyze
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-java@v1
14+
with:
15+
java-version: "12.x"
16+
- uses: subosito/flutter-action@v1
17+
with:
18+
channel: "stable"
19+
20+
- name: 📦 Install Dependencies
21+
run: flutter pub get
22+
23+
- name: 🩺 Analyze Formatting
24+
run: flutter analyze
25+
26+
- name: 📕 Analyze Formatting
27+
run: dart format --line-length 120 .
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build and Deploy to Cloudflare R2
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
build-and-upload:
10+
runs-on: ubuntu-latest # For macOS, use '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: stable
20+
21+
- name: Install dependencies
22+
run: flutter pub get
23+
24+
- name: Build macOS app
25+
run: flutter build macos
26+
27+
- name: Build Windows app
28+
run: flutter build windows
29+
30+
- name: Upload macOS build to Cloudflare R2
31+
run: |
32+
sudo apt install awscli
33+
aws configure set aws_access_key_id ${{ secrets.R2_ACCESS_KEY_ID }}
34+
aws configure set aws_secret_access_key ${{ secrets.R2_SECRET_ACCESS_KEY }}
35+
aws configure set default.region auto
36+
37+
aws s3 cp --endpoint-url=https://$R2_ACCOUNT_ID.r2.cloudflarestorage.com \
38+
build/macos/Build/Products/Release/MyApp.dmg s3://${{ secrets.R2_BUCKET_NAME }}/macos/MyApp.dmg --acl public-read
39+
40+
echo "✅ macOS build uploaded!"
41+
42+
- name: Upload Windows build to Cloudflare R2
43+
run: |
44+
aws s3 cp --endpoint-url=https://$R2_ACCOUNT_ID.r2.cloudflarestorage.com \
45+
build/windows/runner/Release/MyApp.exe s3://${{ secrets.R2_BUCKET_NAME }}/windows/MyApp.exe --acl public-read
46+
47+
echo "✅ Windows build uploaded!"
48+
49+
- name: Generate Public Links
50+
run: |
51+
echo "Download macOS App: https://${{ secrets.R2_ACCOUNT_ID }}.r2.dev/${{ secrets.R2_BUCKET_NAME }}/macos/MyApp.dmg"
52+
echo "Download Windows App: https://${{ secrets.R2_ACCOUNT_ID }}.r2.dev/${{ secrets.R2_BUCKET_NAME }}/windows/MyApp.exe"

0 commit comments

Comments
 (0)