-
Notifications
You must be signed in to change notification settings - Fork 31
145 lines (142 loc) · 4.88 KB
/
ci.yml
File metadata and controls
145 lines (142 loc) · 4.88 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
name: CI
on:
push:
branches:
- main
- dev
paths-ignore:
- README.md
- README_CN.md
- LICENSE
pull_request:
paths-ignore:
- README.md
- README_CN.md
- LICENSE
jobs:
build-windows:
name: Build Windows
runs-on: windows-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Generate code
run: flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs
- name: Build Flutter application for Windows
run: flutter build windows
- name: Create ZIP archive
run: |
# Create a directory to hold the files
mkdir Iris
# Copy the build output to the Iris directory
Copy-Item -Path "build\windows\x64\runner\Release\*" -Destination "Iris" -Force
# Create a ZIP file
Compress-Archive -Path "Iris" -DestinationPath "Iris-windows.zip"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: Iris-windows
path: Iris-windows.zip
- name: Create installer
run: iscc inno.iss
- name: Upload installer
uses: actions/upload-artifact@v4
with:
name: Iris-windows-installer
path: build\windows\x64\runner\Release\Iris-windows-installer.exe
build-android:
name: Build Android
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
- name: Generate code
run: flutter pub get && flutter pub run build_runner build --delete-conflicting-outputs
- name: Set up Java
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 21
- name: Decode and save keystore
run: |
echo "${{ secrets.KEYSTORE }}" | base64 --decode > android/app/keystore.jks
- name: Save key.properties
run: |
echo "storePassword=${{ secrets.STORE_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 Flutter application for Android
run: flutter build apk --split-per-abi
- name: Rename armeabi-v7a APK
run: mv build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk Iris-android-armeabi-v7a.apk
- name: Rename arm64-v8a APK
run: mv build/app/outputs/flutter-apk/app-arm64-v8a-release.apk Iris-android-arm64-v8a.apk
- name: Rename x86_64 APK
run: mv build/app/outputs/flutter-apk/app-x86_64-release.apk Iris-android-x86_64.apk
- name: Upload armeabi-v7a APK
uses: actions/upload-artifact@v4
with:
name: Iris-android-armeabi-v7a
path: Iris-android-armeabi-v7a.apk
- name: Upload arm64-v8a APK
uses: actions/upload-artifact@v4
with:
name: Iris-android-arm64-v8a
path: Iris-android-arm64-v8a.apk
- name: Upload x86_64 APK
uses: actions/upload-artifact@v4
with:
name: Iris-android-x86_64
path: Iris-android-x86_64.apk
release:
name: Release
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
runs-on: ubuntu-latest
needs: [build-windows, build-android]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Get version
id: yq
uses: mikefarah/yq@master
with:
cmd: yq '.version' 'pubspec.yaml'
- name: Print version
run: echo ${{ steps.yq.outputs.result }}
- name: Create Tag
id: create_tag
run: |
VERSION="${{ steps.yq.outputs.result }}"
TAG_NAME="v${VERSION%%+*}"
echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_OUTPUT"
- name: Eextract log
run: python extract_log.py ${{ steps.create_tag.outputs.TAG_NAME }}
- name: Download artifact
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.TAG_NAME }}
body_path: CHANGELOG_${{ steps.create_tag.outputs.TAG_NAME }}.md
draft: false
prerelease: false
files: |
artifacts/Iris-windows.zip
artifacts/Iris-windows-installer.exe
artifacts/Iris-android-armeabi-v7a.apk
artifacts/Iris-android-arm64-v8a.apk
artifacts/Iris-android-x86_64.apk