Skip to content

Commit 3af207a

Browse files
Distribute Open Source
0 parents  commit 3af207a

311 files changed

Lines changed: 17668 additions & 0 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 237 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,237 @@
1+
name: Flutter CI/CD
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
release:
8+
types: [published]
9+
10+
permissions:
11+
actions: read
12+
contents: write
13+
14+
jobs:
15+
android:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Clone repository
19+
uses: actions/checkout@v4
20+
21+
- name: Set up Java
22+
uses: actions/setup-java@v4
23+
with:
24+
distribution: 'temurin'
25+
java-version: '17'
26+
27+
- name: Set up Flutter
28+
uses: subosito/flutter-action@v2
29+
with:
30+
flutter-version: '3.40.0-0.2.pre'
31+
channel: 'beta'
32+
33+
- name: Get Flutter dependencies
34+
run: flutter pub get
35+
36+
- name: Auto-generated files setup
37+
run: flutter pub run build_runner build --delete-conflicting-outputs
38+
39+
- name: Build APK
40+
run: flutter build apk --release --split-per-abi --target-platform android-arm64
41+
42+
- name: Upload APK artifacts
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: android-apks
46+
path: |
47+
build/app/outputs/flutter-apk/*.apk
48+
retention-days: 30
49+
50+
windows:
51+
runs-on: windows-latest
52+
steps:
53+
- name: Clone repository
54+
uses: actions/checkout@v4
55+
56+
- name: Set up Flutter
57+
uses: subosito/flutter-action@v2
58+
with:
59+
flutter-version: '3.40.0-0.2.pre'
60+
channel: 'beta'
61+
62+
- name: Get Flutter dependencies
63+
run: flutter pub get
64+
65+
- name: Auto-generated files setup
66+
run: flutter pub run build_runner build --delete-conflicting-outputs
67+
68+
- name: Build Windows EXE
69+
run: flutter build windows --release
70+
71+
- name: Upload Windows artifacts
72+
uses: actions/upload-artifact@v4
73+
with:
74+
name: windows-exe
75+
path: |
76+
build/windows/x64/runner/Release/*
77+
retention-days: 30
78+
79+
ios:
80+
runs-on: macos-latest
81+
steps:
82+
- name: Clone repository
83+
uses: actions/checkout@v4
84+
85+
- name: Select Xcode version
86+
run: sudo xcode-select -s /Applications/Xcode_16.4.app
87+
88+
- name: Set up Flutter
89+
uses: subosito/flutter-action@v2
90+
with:
91+
flutter-version: '3.40.0-0.2.pre'
92+
channel: 'beta'
93+
94+
- name: Get Flutter dependencies
95+
run: flutter pub get
96+
97+
- name: Auto-generated files setup
98+
run: flutter pub run build_runner build --delete-conflicting-outputs
99+
100+
- name: Build iOS app bundle
101+
run: flutter build ios --release --no-codesign
102+
103+
- name: Create unsigned IPA
104+
run: |
105+
APP_BUNDLE="build/ios/iphoneos/Runner.app"
106+
IPA_PATH="build/ios/iphoneos/DistributeApp.ipa"
107+
mkdir -p Payload
108+
cp -R "$APP_BUNDLE" Payload/
109+
zip -r "$IPA_PATH" Payload
110+
rm -rf Payload
111+
112+
echo "Created unsigned IPA at $IPA_PATH"
113+
114+
- name: Upload iOS IPA artifact
115+
uses: actions/upload-artifact@v4
116+
with:
117+
name: ios-ipa
118+
path: build/ios/iphoneos/*.ipa
119+
retention-days: 30
120+
121+
macos:
122+
runs-on: macos-latest
123+
steps:
124+
- name: Clone repository
125+
uses: actions/checkout@v4
126+
127+
- name: Set up Flutter
128+
uses: subosito/flutter-action@v2
129+
with:
130+
flutter-version: '3.40.0-0.2.pre'
131+
channel: 'beta'
132+
133+
- name: Get Flutter dependencies
134+
run: flutter pub get
135+
136+
- name: Auto-generated files setup
137+
run: flutter pub run build_runner build --delete-conflicting-outputs
138+
139+
- name: Build macOS app
140+
run: flutter build macos --release
141+
142+
- name: Create DMG
143+
run: |
144+
# Install create-dmg if not present
145+
brew install create-dmg || true
146+
147+
# Prepare paths
148+
mkdir -p dist
149+
APP_PATH="build/macos/Build/Products/Release/DistributeApp.app"
150+
APP_NAME="DistributeApp"
151+
TEMP_DIR="temp_dmg_source"
152+
DMG_NAME="dist/${APP_NAME}-${{ github.sha }}.dmg"
153+
154+
# Create temporary source folder and copy app bundle into it
155+
mkdir -p "$TEMP_DIR"
156+
cp -R "$APP_PATH" "$TEMP_DIR/"
157+
158+
# Create DMG
159+
create-dmg \
160+
--volname "${APP_NAME}-${{ github.sha }}" \
161+
--volicon "$APP_PATH/Contents/Resources/AppIcon.icns" \
162+
--window-pos 200 120 \
163+
--window-size 800 400 \
164+
--icon-size 100 \
165+
--icon "$APP_NAME.app" 200 190 \
166+
--hide-extension "$APP_NAME.app" \
167+
--app-drop-link 600 185 \
168+
"$DMG_NAME" \
169+
"$TEMP_DIR"
170+
171+
# Cleanup
172+
rm -rf "$TEMP_DIR"
173+
174+
- name: Upload macOS DMG artifact
175+
uses: actions/upload-artifact@v4
176+
with:
177+
name: macos-dmg
178+
path: dist/*.dmg
179+
retention-days: 30
180+
181+
release:
182+
needs: [android, windows, ios, macos]
183+
runs-on: ubuntu-latest
184+
if: startsWith(github.ref, 'refs/tags/')
185+
steps:
186+
- name: Download artifacts
187+
uses: actions/download-artifact@v4
188+
with:
189+
path: artifacts
190+
191+
- name: Rename and Prepare Assets
192+
run: |
193+
mkdir release_assets
194+
VERSION="${{ github.ref_name }}"
195+
196+
# 1. Android (Separate APKs per architecture)
197+
# Input: app-arm64-v8a-release.apk -> Output: android-arm64-v8a-v0.0.5.apk
198+
if [ -d "artifacts/android-apks" ]; then
199+
cd artifacts/android-apks
200+
for apk in *.apk; do
201+
# Extract the ABI (e.g. arm64-v8a) by stripping 'app-' and '-release.apk'
202+
suffix="${apk#app-}"
203+
abi="${suffix%-release.apk}"
204+
205+
cp "$apk" "../../release_assets/android-${abi}-${VERSION}.apk"
206+
done
207+
cd ../..
208+
fi
209+
210+
# 2. Windows (Zip EXE + DLLs)
211+
# Windows builds must stay together in a folder, so we zip them.
212+
if [ -d "artifacts/windows-exe" ]; then
213+
cd artifacts/windows-exe
214+
zip -r "../../release_assets/windows-${VERSION}.zip" .
215+
cd ../..
216+
fi
217+
218+
# 3. iOS (Rename single IPA)
219+
if [ -d "artifacts/ios-ipa" ]; then
220+
find artifacts/ios-ipa -name "*.ipa" -exec cp {} "release_assets/ios-${VERSION}.ipa" \;
221+
fi
222+
223+
# 4. macOS (Rename single DMG)
224+
if [ -d "artifacts/macos-dmg" ]; then
225+
find artifacts/macos-dmg -name "*.dmg" -exec cp {} "release_assets/macos-${VERSION}.dmg" \;
226+
fi
227+
228+
# List files to verify
229+
ls -l release_assets/
230+
231+
- name: Create Release
232+
uses: softprops/action-gh-release@v2
233+
with:
234+
files: release_assets/*
235+
generate_release_notes: true
236+
env:
237+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Debug Release Logic
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
run_id:
6+
description: 'The Run ID of the successful build'
7+
required: true
8+
version:
9+
description: 'Version tag to simulate'
10+
required: true
11+
12+
permissions:
13+
actions: read
14+
contents: write
15+
16+
jobs:
17+
debug-release:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Download artifacts from specific run
21+
uses: dawidd6/action-download-artifact@v3
22+
with:
23+
run_id: ${{ inputs.run_id }}
24+
path: artifacts
25+
26+
- name: Rename and Prepare Assets
27+
run: |
28+
mkdir release_assets
29+
VERSION="${{ inputs.version }}"
30+
31+
# Android: Rename individual APKs
32+
if [ -d "artifacts/android-apks" ]; then
33+
cd artifacts/android-apks
34+
for apk in *.apk; do
35+
suffix="${apk#app-}"
36+
abi="${suffix%-release.apk}"
37+
cp "$apk" "../../release_assets/android-${abi}-${VERSION}.apk"
38+
done
39+
cd ../..
40+
fi
41+
42+
# Windows: Zip
43+
if [ -d "artifacts/windows-exe" ]; then
44+
cd artifacts/windows-exe
45+
zip -r "../../release_assets/windows-${VERSION}.zip" .
46+
cd ../..
47+
fi
48+
49+
# iOS: Rename
50+
if [ -d "artifacts/ios-ipa" ]; then
51+
find artifacts/ios-ipa -name "*.ipa" -exec cp {} "release_assets/ios-${VERSION}.ipa" \;
52+
fi
53+
54+
# macOS: Rename
55+
if [ -d "artifacts/macos-dmg" ]; then
56+
find artifacts/macos-dmg -name "*.dmg" -exec cp {} "release_assets/macos-${VERSION}.dmg" \;
57+
fi
58+
59+
echo "Files prepared:"
60+
ls -l release_assets/
61+
62+
- name: Create Test Release
63+
uses: softprops/action-gh-release@v2
64+
with:
65+
tag_name: ${{ inputs.version }}
66+
files: release_assets/*
67+
draft: true
68+
prerelease: true
69+
name: "Test Release ${{ inputs.version }}"
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# Miscellaneous
2+
*.class
3+
*.log
4+
*.pyc
5+
*.swp
6+
.DS_Store
7+
.atom/
8+
.build/
9+
.buildlog/
10+
.history
11+
.svn/
12+
.swiftpm/
13+
migrate_working_dir/
14+
15+
# IntelliJ related
16+
*.iml
17+
*.ipr
18+
*.iws
19+
.idea/
20+
21+
# The .vscode folder
22+
.vscode/
23+
24+
# Flutter/Dart/Pub related
25+
**/doc/api/
26+
**/ios/Flutter/.last_build_id
27+
.dart_tool/
28+
.flutter-plugins-dependencies
29+
.pub-cache/
30+
.pub/
31+
/build/
32+
/coverage/
33+
34+
# Symbolication related
35+
app.*.symbols
36+
37+
# Obfuscation related
38+
app.*.map.json
39+
40+
# Android Studio will place build artifacts here
41+
/android/app/debug
42+
/android/app/profile
43+
/android/app/release
44+
45+
# Auto generated files
46+
*.freezed.dart
47+
*.g.dart

0 commit comments

Comments
 (0)