-
-
Notifications
You must be signed in to change notification settings - Fork 13
234 lines (229 loc) · 9.06 KB
/
publish.yml
File metadata and controls
234 lines (229 loc) · 9.06 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: Release and publish apps
on:
workflow_dispatch:
jobs:
build-android:
name: Build for Android
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Install Ninja
run: sudo apt-get install -y ninja-build
- uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '21'
- uses: subosito/flutter-action@v2
with:
channel: 'stable'
- run: flutter pub get
- run: dart run pdfrx:remove_wasm_modules
- name: Patch pdfrx
run: |
PDFRX_PATH=$(find $HOME/.pub-cache -type d -name "pdfium_flutter-*" | head -n 1)
CMAKE_FILE="$PDFRX_PATH/android/CMakeLists.txt"
if [ -f "$CMAKE_FILE" ]; then
sed -i '2i add_link_options("LINKER:--build-id=none")' "$CMAKE_FILE"
echo "Patched CMakeLists.txt in $CMAKE_FILE"
else
echo "CMakeLists.txt not found in expected location"
exit 1
fi
- name: Patch dartjni
run: |
JNI_CMAKE=$(find $HOME/.pub-cache/hosted/pub.dev -path "*/jni-*/src/CMakeLists.txt" | head -n 1)
if [ -n "$JNI_CMAKE" ] && [ -f "$JNI_CMAKE" ]; then
sed -i '2i add_link_options("LINKER:--build-id=none")' "$JNI_CMAKE"
echo "Patched CMakeLists.txt in $JNI_CMAKE"
else
echo "Error: jni CMakeLists.txt not found in expected location."
exit 1
fi
- name: Decode Keystore
run: |
echo "${{ secrets.KEYSTORE_BASE64 }}" | base64 --decode > android/app/keystore.jks
- name: Create key.properties
run: |
echo "storePassword=${{ secrets.KEYSTORE_PASSWORD }}" > android/key.properties
echo "keyPassword=${{ secrets.KEY_PASSWORD }}" >> android/key.properties
echo "keyAlias=${{ secrets.KEY_ALIAS }}" >> android/key.properties
echo "storeFile=keystore.jks" >> android/key.properties
- name: Build APK
run: flutter build apk --release
- name: Build appBundle
run: flutter build appbundle
- name: Prepare Android artifacts
run: |
mkdir -p release-artifacts
cp build/app/outputs/flutter-apk/app-release.apk release-artifacts/
cp build/app/outputs/bundle/release/app-release.aab release-artifacts/
- name: Upload Artifacts
uses: actions/upload-artifact@v7
with:
name: android-artifacts
path: release-artifacts/
- name: Create google_service_account.json
run: |
echo "${{ secrets.GOOGLE_SERVICE_ACCOUNT }}" | base64 --decode > android/google_service_account.json
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '4.0.3'
bundler-cache: true
working-directory: 'android'
- name: Deploy to Play Store
uses: maierj/fastlane-action@v3.1.0
with:
lane: deploy
subdirectory: android
# build-macos:
# name: Build for macOS
# runs-on: macos-15
# steps:
# - uses: actions/checkout@v6
# - uses: maxim-lobanov/setup-xcode@v1
# with:
# xcode-version: latest-stable
# - uses: subosito/flutter-action@v2
# with:
# channel: 'stable'
# - run: flutter pub get
# - run: flutter build macos --release
# - name: Codesign executable
# env:
# MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
# MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
# KEYCHAIN_PASSWORD: ${{ secrets.MACOS_KEYCHAIN_PASSWORD }}
# MACOS_SIGN_IDENTITY: ${{ secrets.MACOS_SIGN_IDENTITY }}
# run: |
# echo "$MACOS_CERTIFICATE" | base64 --decode > certificate.p12
# security create-keychain -p $KEYCHAIN_PASSWORD build.keychain
# security default-keychain -s build.keychain
# security unlock-keychain -p $KEYCHAIN_PASSWORD build.keychain
# security import certificate.p12 -k build.keychain -P $MACOS_CERTIFICATE_PWD -T /usr/bin/codesign
# security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k $KEYCHAIN_PASSWORD build.keychain
# security find-identity
# /usr/bin/codesign --force --deep --options runtime --entitlements macos/Runner/Release.entitlements -s "$MACOS_SIGN_IDENTITY" build/macos/Build/Products/Release/Wispar.app
# /usr/bin/codesign --verify --deep --strict --verbose=2 build/macos/Build/Products/Release/Wispar.app
# - name: Notarize app
# env:
# APPLE_ID: ${{ secrets.APPLE_ID }}
# APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
# uses: lando/notarize-action@v2
# with:
# product-path: "build/macos/Build/Products/Release/Wispar.app"
# appstore-connect-username: ${{ secrets.APPLE_ID }}
# appstore-connect-password: ${{ secrets.APPLE_PASSWORD }}
# appstore-connect-team-id: ${{ secrets.APPLE_TEAM_ID }}
# - name: Staple notarization
# run: |
# xcrun stapler staple build/macos/Build/Products/Release/Wispar.app
# - name: Create dmg
# env:
# MACOS_SIGN_IDENTITY: ${{ secrets.MACOS_SIGN_IDENTITY }}
# run: |
# brew install create-dmg
# create-dmg \
# --volname "Wispar" \
# --window-size 800 529 \
# --icon-size 130 \
# --app-drop-link 540 250 \
# "Wispar.dmg" \
# build/macos/Build/Products/Release/Wispar.app
# /usr/bin/codesign --force -s "$MACOS_SIGN_IDENTITY" Wispar.dmg
# - uses: actions/upload-artifact@v7
# with:
# name: wispar-macos-dmg
# path: Wispar.dmg
build-windows:
name: Build for Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: 'stable'
- name: Flutter pub get
run: flutter pub get
- name: Build Windows release
run: flutter build windows --release
- name: Copy required DLLs
shell: powershell
run: |
Copy-Item "C:\Windows\System32\msvcp140.dll" -Destination ".\build\windows\x64\runner\Release\"
Copy-Item "C:\Windows\System32\msvcp140_1.dll" -Destination ".\build\windows\x64\runner\Release\"
Copy-Item "C:\Windows\System32\msvcp140_2.dll" -Destination ".\build\windows\x64\runner\Release\"
Copy-Item "C:\Windows\System32\vcruntime140.dll" -Destination ".\build\windows\x64\runner\Release\"
Copy-Item "C:\Windows\System32\vcruntime140_1.dll" -Destination ".\build\windows\x64\runner\Release\"
- name: Install Inno Setup
shell: powershell
run: |
choco install innosetup -y
refreshenv
- name: Extract version from pubspec.yaml
shell: pwsh
id: extract_version
run: |
$pubspec = Get-Content pubspec.yaml
foreach ($line in $pubspec) {
if ($line -match '^version:\s*(.+)$') {
$version = $matches[1]
break
}
}
Write-Host "VERSION=$version"
echo "VERSION=$version" >> $env:GITHUB_ENV
- name: Patch ISS with correct version
shell: powershell
run: |
$issPath = ".\windows\wispar_setup.iss"
(Get-Content $issPath) -replace '#define MyAppVersion ".*"', '#define MyAppVersion "${{ env.VERSION }}"' | Set-Content $issPath
Write-Host "Patched ISS file with version ${{ env.VERSION }}"
- name: Create Windows installer
shell: powershell
run: |
$issPath = ".\windows\wispar_setup.iss"
& "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" $issPath
- name: Upload Windows installer
uses: actions/upload-artifact@v7
with:
name: windows-artifacts
path: windows\output\wispar_setup.exe
create-release:
name: Create GitHub Release
runs-on: ubuntu-latest
needs: [build-android, build-windows] #[build-android, build-macos, build-windows]
steps:
- uses: actions/checkout@v6
- name: Download Android artifacts
uses: actions/download-artifact@v8
with:
name: android-artifacts
path: android-artifacts
# - name: Download macOS artifact
# uses: actions/download-artifact@v8
# with:
# name: wispar-macos-dmg
# path: macos-artifacts
- name: Download Windows artifact
uses: actions/download-artifact@v8
with:
name: windows-artifacts
path: windows-artifacts
- name: Extract version from pubspec.yaml
id: extract_version
run: |
version=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')
echo "VERSION=$version" >> $GITHUB_ENV
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: |
android-artifacts/app-release.apk,
android-artifacts/app-release.aab,
windows-artifacts/wispar_setup.exe
tag: v${{ env.VERSION }}
token: ${{ secrets.TOKEN }}
draft: true
generateReleaseNotes: true