-
-
Notifications
You must be signed in to change notification settings - Fork 198
158 lines (131 loc) · 7.65 KB
/
Copy pathmain.yml
File metadata and controls
158 lines (131 loc) · 7.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
name: "Build & Release"
on:
workflow_dispatch:
jobs:
# JOB 1: WINDOWS & ANDROID
build-windows-android:
name: Build Windows & Android
runs-on: windows-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup-Java
uses: actions/setup-java@v3.12.0
with:
distribution: 'oracle'
java-version: '17'
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.4'
channel: 'stable'
- name: Install Dependencies
run: flutter pub get
- name: Extract version from pubspec.yaml
shell: powershell
run: |
$vLine = Select-String -Path pubspec.yaml -Pattern '^version:\s*(\S+)' | Select-Object -First 1
if (-not $vLine) { Write-Error 'version not found in pubspec.yaml'; exit 1 }
$ver = $vLine.Matches[0].Groups[1].Value.Split('+')[0]
echo "VERSION=$ver" >> $env:GITHUB_ENV
- name: Create keystore file
run: |
$b64 = "${{ secrets.KEY_STORE }}"
$filename = "./android/bloomee.jks"
$bytes =[Convert]::FromBase64String($b64)
[IO.File]::WriteAllBytes($filename, $bytes)
- name: Create Keystore properties
run: |
echo keyPassword=\${{ secrets.KEY_PASSWORD }} > ./android/key.properties
echo storePassword=\${{ secrets.STORE_PASSWORD }} >> ./android/key.properties
echo keyAlias=\${{ secrets.KEY_ALIAS }} >> ./android/key.properties
- name: Build App files
run: flutter build apk --release --split-per-abi --build-number ${{github.run_number}}
- name: Verify Sign
run: |
$buildToolsDir = Get-ChildItem "$env:ANDROID_HOME\build-tools" | Where-Object { $_.PSIsContainer } | Sort-Object Name -Descending | Select-Object -First 1
Write-Host "Using build tools version: $($buildToolsDir.Name)"
& "$($buildToolsDir.FullName)\apksigner.bat" verify build/app/outputs/flutter-apk/app-release.apk
& "$($buildToolsDir.FullName)\apksigner.bat" verify build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk
& "$($buildToolsDir.FullName)\apksigner.bat" verify build/app/outputs/flutter-apk/app-arm64-v8a-release.apk
& "$($buildToolsDir.FullName)\apksigner.bat" verify build/app/outputs/flutter-apk/app-x86_64-release.apk
- name: Rename APK file
shell: powershell
run: |
Rename-Item -Path "build/app/outputs/flutter-apk/app-release.apk" -NewName "bloomee_tunes_android_v$env:VERSION+${{github.run_number}}_universal.apk"
Rename-Item -Path "build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk" -NewName "bloomee_tunes_android_v$env:VERSION+${{github.run_number}}_armeabi-v7a.apk"
Rename-Item -Path "build/app/outputs/flutter-apk/app-arm64-v8a-release.apk" -NewName "bloomee_tunes_android_v$env:VERSION+${{github.run_number}}_arm64-v8a.apk"
Rename-Item -Path "build/app/outputs/flutter-apk/app-x86_64-release.apk" -NewName "bloomee_tunes_android_v$env:VERSION+${{github.run_number}}_x86_64.apk"
- name: Build Windows App
run: flutter build windows --release --build-number ${{github.run_number}}
- name: Create build-number.txt file
run: echo ${{github.run_number}} > build-number.txt
- name: Rename file
run: Rename-Item -Path "build/windows/x64/runner/Release/bloomee.exe" -NewName "Bloomee.exe"
- name: ZIP build
run: Compress-Archive -Path build/windows/x64/runner/Release/* -Destination build/windows/x64/bloomee_tunes_windows_x64_v${{ env.VERSION }}+${{github.run_number}}.zip
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: Release-Windows-Android
path: |
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_universal.apk
build/windows/x64/bloomee_tunes_windows_x64_v${{ env.VERSION }}+${{github.run_number}}.zip
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_armeabi-v7a.apk
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_arm64-v8a.apk
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_x86_64.apk
build-number.txt
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: |
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_universal.apk
build/windows/x64/bloomee_tunes_windows_x64_v${{ env.VERSION }}+${{github.run_number}}.zip
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_armeabi-v7a.apk
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_arm64-v8a.apk
build/app/outputs/flutter-apk/bloomee_tunes_android_v${{ env.VERSION }}+${{github.run_number}}_x86_64.apk
build-number.txt
tag: v${{ env.VERSION }}+${{github.run_number}}
token: ${{secrets.SECRET_KEY}}
prerelease: true
allowUpdates: true
build-linux:
name: Build Linux
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.35.4'
channel: 'stable'
- name: Install Linux Dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang cmake git ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
- name: Install Dependencies
run: flutter pub get
- name: Extract version from pubspec.yaml
run: |
VERSION=$(grep -E '^version:' pubspec.yaml | awk '{print $2}' | cut -d'+' -f1)
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Build Linux App
run: flutter build linux --release --build-number ${{github.run_number}}
- name: Compress Linux Build
run: |
tar -czf bloomee_tunes_linux_x64_v${{ env.VERSION }}+${{github.run_number}}.tar.gz -C build/linux/x64/release/bundle .
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: Release-Linux
path: bloomee_tunes_linux_x64_v${{ env.VERSION }}+${{github.run_number}}.tar.gz
- name: Publish Linux to Release
uses: ncipollo/release-action@v1
with:
artifacts: bloomee_tunes_linux_x64_v${{ env.VERSION }}+${{github.run_number}}.tar.gz
tag: v${{ env.VERSION }}+${{github.run_number}}
token: ${{secrets.SECRET_KEY}}
prerelease: true
allowUpdates: true
omitBodyDuringUpdate: true