-
Notifications
You must be signed in to change notification settings - Fork 173
160 lines (149 loc) · 5.59 KB
/
release.yml
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
# This is a basic workflow to help you get started with Actions
name: Release CI
on:
push:
tags:
- v*
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
generate-changelog:
# needs: ["build-and-release-android", "build-and-release-windows"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: main
- uses: actions/setup-node@v3
with:
node-version: 16.x
- run: npx changelogithub
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
# This workflow contains a single job called "build"
build-and-release-android:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
ref: main
- name: Flutter action
uses: subosito/flutter-action@v2
with:
flutter-version: 3.13.0
channel: stable
- name: Decode keystore
run: |
echo $ENCODED_KEYSTORE | base64 -di > android/app/keystore.jks
env:
ENCODED_KEYSTORE: ${{ secrets.KEYSTORE }}
- run: flutter pub get
# 打包apk
- name: Collect Apks
run: flutter build apk --release --split-per-abi -v
env:
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASSWORD }}
KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
KEY_PASSWORD: ${{ secrets.KEY_PASSWORD}}
# 发布安装包
- name: Upload Artifact - armeabi-v7a
uses: actions/upload-artifact@v3
with:
path: "build/app/outputs/flutter-apk/app-armeabi-v7a-release.apk"
name: Miru-${{github.ref_name}}-armeabi-v7a.apk
- name: Upload Artifact - arm64-v8a
uses: actions/upload-artifact@v3
with:
path: "build/app/outputs/flutter-apk/app-arm64-v8a-release.apk"
name: Miru-${{github.ref_name}}-arm64-v8a.apk
- name: Upload Artifact - x86
uses: actions/upload-artifact@v3
with:
path: "build/app/outputs/flutter-apk/app-x86_64-release.apk"
name: Miru-${{github.ref_name}}-x86_64.apk
- name: Release Packages
uses: ncipollo/release-action@v1
with:
artifacts: "build/app/outputs/flutter-apk/app-*.apk"
allowUpdates: true
omitBody: true
# build-and-release-linux:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# ref: main
# - uses: subosito/flutter-action@v2
# with:
# flutter-version: 3.10.3
# channel: stable
# - name: Install dependencies
# run: sudo apt-get install -y clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libmpv-dev mpv
# - name: Install project dependencies
# run: flutter pub get
# - name: Generate intermediates
# run: flutter pub run build_runner build --delete-conflicting-outputs
# - name: Enable linux build
# run: flutter config --enable-linux-desktop
# - name: Build artifacts
# run: flutter build linux --release
# - name: Archive Release
# uses: thedoctor0/zip-release@master
# with:
# type: "zip"
# filename: Miru-${{github.ref_name}}-linux.zip
# directory: build/linux/x64/release/bundle
# # 发布安装包
# - name: Upload Artifact
# uses: actions/upload-artifact@v3
# with:
# path: "build/linux/x64/release/bundle/Miru-${{github.ref_name}}-linux.zip"
# - name: Release Packages
# uses: ncipollo/release-action@v1
# with:
# artifacts: "build/linux/x64/release/bundle/Miru-${{github.ref_name}}-linux.zip"
# allowUpdates: true
build-and-release-windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
ref: main
- uses: subosito/flutter-action@v2
with:
flutter-version: 3.13.0
channel: stable
- name: Install project dependencies
run: flutter pub get
- name: Build artifacts
run: flutter build windows --release -v
- name: Build Installer
run: iex ("& {0} {1} {2}" -f '"C:\Program Files (x86)\Inno Setup 6\iscc.exe"',"/DMyAppVersion='${{github.ref_name}}'", ".\inno_setup.iss")
- name: Archive Release
uses: thedoctor0/zip-release@master
with:
type: "zip"
filename: Miru-${{github.ref_name}}-windows.zip
directory: build/windows/runner/Release
- name: Rename Release Directory Name to Miru-App # For Artifacts.
# 但是此处将压缩出来的包迁移到了一个临时 temp 目录,这是用来上传到 Release Assets 的
# 再下面的重命名是为了 Artifacts 的
run: |
mkdir temp
mv build/windows/runner/Release/Miru-${{github.ref_name}}-windows.zip temp/Miru-${{github.ref_name}}-windows.zip
mv build/windows/runner/Release build/windows/runner/Miru-App
# 发布安装包
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
path: "build/windows/runner/Miru-App"
name: Miru-pr-${{ github.event.pull_request.number }}-windows.zip
- name: Release Packages
uses: ncipollo/release-action@v1
with:
artifacts: "temp/Miru-${{github.ref_name}}-windows.zip,Output/*.exe"
allowUpdates: true
omitBody: true