Skip to content

Commit 85f27a4

Browse files
committed
auto upload deb to release
1 parent e588e41 commit 85f27a4

File tree

6 files changed

+99
-0
lines changed

6 files changed

+99
-0
lines changed

.github/workflows/release.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Release
2+
on:
3+
push:
4+
tags:
5+
- v*.*.*
6+
branches:
7+
- test*
8+
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- uses: subosito/flutter-action@v2
17+
with:
18+
channel: 'beta'
19+
20+
- run: flutter config --enable-linux-desktop
21+
22+
- name: Patch for linux build
23+
run: |
24+
sudo apt-get update -y
25+
sudo apt-get install -y ninja-build libgtk-3-dev
26+
sudo apt install libavcodec-dev libavformat-dev libavdevice-dev
27+
sudo apt-get install libsdl2-dev
28+
flutter doctor
29+
30+
- name: Build APP
31+
run: flutter build linux
32+
33+
- name: Bundle deb
34+
run: ./dist/linux_deb.sh
35+
36+
- name: upload release artifact.
37+
uses: svenstaro/upload-release-action@v2
38+
with:
39+
repo_token: ${{ secrets.GITHUB_TOKEN }}
40+
file: build/quiet_amd64.deb
41+
tag: ${{ github.ref }}
42+
overwrite: true
43+
file_glob: true

dist/deb/DEBIAN/control

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
Section: x11
2+
Priority: optional
3+
Version: 1.0.0
4+
Homepage: https://github.com/boyan01/flutter-netease-music
5+
Package: quiet
6+
Maintainer: boyan
7+
Architecture: amd64
8+
Depends: libgtk-3-0 (>= 3.10.0), libsdl2-2.0-0, libavcodec58, libavformat58
9+
Description: A Universal copy app of Netease Music
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[Desktop Entry]
2+
Type=Application
3+
Name=Quiet
4+
Comment=A Universal copy app of Netease Music
5+
GenericName=Music Player
6+
Categories=Audio
7+
Version=1.0
8+
Exec=quiet
9+
Terminal=false
10+
Icon=quiet
2.45 KB
Loading
4.78 KB
Loading

dist/linux_deb.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
3+
app_name="quiet"
4+
current_dir=$(dirname "$0")
5+
6+
project_dir="${current_dir}/.."
7+
package_dir="${project_dir}/build/deb_package"
8+
9+
rm -rf "${package_dir}"
10+
11+
control_file="${current_dir}/deb/DEBIAN/control"
12+
13+
# read version from pubspec.yaml
14+
version=$(cat "${project_dir}/pubspec.yaml" | grep "^version:" | awk '{print $2}' | tr -d '"')
15+
version=$(echo "${version}" | sed 's/+.*//')
16+
17+
# check version only contains numbers and dots
18+
if ! [[ "${version}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
19+
echo "Error: Invalid version format: ${version}"
20+
exit 1
21+
fi
22+
23+
echo "update control file with version: ${version}"
24+
# update control file version
25+
sed -i "s/Version:.*/Version: ${version}/g" "${control_file}"
26+
27+
cp -fr "$current_dir/deb/." "$package_dir"
28+
mkdir -p "$package_dir/usr/lib/$app_name"
29+
cp -fr "$project_dir/build/linux/x64/release/bundle/." \
30+
"$package_dir/usr/lib/$app_name"
31+
32+
mkdir -p "$package_dir/usr/bin"
33+
pushd "$package_dir/usr/bin" || exit
34+
ln -s "../lib/$app_name/$app_name" "$app_name"
35+
popd || exit
36+
37+
dpkg-deb --build --root-owner-group "$package_dir" "$project_dir/build/${app_name}_amd64.deb"

0 commit comments

Comments
 (0)