-
Notifications
You must be signed in to change notification settings - Fork 1
179 lines (147 loc) · 5.98 KB
/
Copy pathprbuild.yml
File metadata and controls
179 lines (147 loc) · 5.98 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
# This is a basic workflow to help you get started with Actions
name: Dev Build CI
on:
push:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
env:
FLUTTER_VERSION: '3.44.4'
GO_VERSION: '1.26.4'
jobs:
build-and-release-android:
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '${{ env.GO_VERSION }}'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
- uses: dtolnay/rust-toolchain@stable
- name: Add Android targets
run: rustup target add aarch64-linux-android armv7-linux-androideabi x86_64-linux-android
- name: Decode keystore
run: |
echo $ENCODED_KEYSTORE | base64 -di > android/app/keystore.jks
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }}
- name: Create AAR directory
run: mkdir src/miru_core/android
- name: Install gomobile
run: |
go install golang.org/x/mobile/cmd/gomobile@latest
go get golang.org/x/mobile/bind
gomobile version || true
gomobile init
working-directory: ./src/miru_core/miru-core
- name: Build Android AAR (gomobile bind)
working-directory: src/miru_core/miru-core/binary
run: |
gomobile bind -tags nosqlite -ldflags="-s -w -checklinkname=0" -o ../../android/libmiru-core.aar -target=android -androidapi 28
- run: flutter pub get
# 打包apk
- name: Collect Apks
run: flutter build apk -v --release --split-per-abi --dart-define=TMDB_API_KEY=${{ secrets.TMDB_API_KEY }} --dart-define=TMDB_ACCESS_TOKEN=${{ secrets.TMDB_ACCESS_TOKEN }}
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
- name: Set artifact timestamp
run: echo "TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ')" >> $GITHUB_ENV
# 发布安装包
- name: Upload Artifact - armeabi-v7a
uses: actions/upload-artifact@v4
with:
path: "build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk"
name: Miru-pr-${{ env.TIMESTAMP }}-armeabi-v7a.apk
- name: Upload Artifact - arm64-v8a
uses: actions/upload-artifact@v4
with:
path: "build/app/outputs/flutter-apk/app-arm64-v8a-release.apk"
name: Miru-pr-${{ env.TIMESTAMP }}-arm64-v8a.apk
- name: Upload Artifact - x86
uses: actions/upload-artifact@v4
with:
path: "build/app/outputs/flutter-apk/app-x86_64-release.apk"
name: Miru-pr-${{ env.TIMESTAMP }}-x86_64.apk
build-and-release-windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{env.GO_VERSION}}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-pc-windows-msvc
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
- name: Build artifacts
run: flutter build windows -v --release --dart-define=TMDB_API_KEY=${{ secrets.TMDB_API_KEY }} --dart-define=TMDB_ACCESS_TOKEN=${{ secrets.TMDB_ACCESS_TOKEN }}
- name: Rename Release Directory Name to Miru-alpha # 为了解压缩后更好看一点
run: |
mv build/windows/x64/runner/Release build/windows/x64/runner/Miru-alpha
# set a timestamp based on the commit time and use that in artifact names
- name: Set artifact timestamps
run: echo "TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ')" >> $GITHUB_ENV
# 发布安装包
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: "build/windows/x64/runner/Miru-alpha"
name: Miru-Alpha-${{ env.TIMESTAMP }}-windows.zip
build-and-release-linux:
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
steps:
- name: Install Dependencies
run: pacman -Sy --noconfirm gtk3 wpewebkit git clang cmake ninja jq alsa-utils alsa-plugins
- name: Config Git to Trust All Repositories
run: |
git config --global --add safe.directory '*'
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: ${{env.GO_VERSION}}
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
targets: x86_64-unknown-linux-gnu
- name: Cache Cargo Dependencies
uses: Swatinem/rust-cache@v2
- name: Build artifacts
run: flutter build linux --release -v --dart-define=TMDB_API_KEY=${{ secrets.TMDB_API_KEY }} --dart-define=TMDB_ACCESS_TOKEN=${{ secrets.TMDB_ACCESS_TOKEN }}
- name: Rename Release Directory Name to Miru-alpha # 为了解压缩后更好看一点
run: |
mv build/linux/x64/release/bundle build/linux/x64/release/Miru-alpha
# set a timestamp based on the commit time and use that in artifact names
- name: Set artifact timestamp
run: echo "TIMESTAMP=$(date -u +'%Y%m%dT%H%M%SZ')" >> $GITHUB_ENV
# 发布安装包
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
path: "build/linux/x64/release/Miru-alpha"
name: Miru-Alpha-${{ env.TIMESTAMP }}-linux