mirror of
https://github.com/yaobiao131/downkyicore.git
synced 2025-08-10 00:52:31 +00:00
feat: 完善构建
This commit is contained in:
163
.github/workflows/build.yml
vendored
Normal file
163
.github/workflows/build.yml
vendored
Normal file
@@ -0,0 +1,163 @@
|
||||
name: Build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
tags:
|
||||
- 'v*'
|
||||
|
||||
jobs:
|
||||
build-windows:
|
||||
runs-on: windows-latest
|
||||
strategy:
|
||||
matrix:
|
||||
cpu: [ x64, x86 ]
|
||||
kind: [ zip ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: |
|
||||
6.0.x
|
||||
- name: Read Version Text
|
||||
id: version
|
||||
uses: juliangruber/read-file-action@v1
|
||||
with:
|
||||
path: version.txt
|
||||
- name: Install Pupnet
|
||||
run: |
|
||||
dotnet tool install -g KuiperZone.PupNet
|
||||
- name: Get Deps
|
||||
run: |
|
||||
.\ffmpeg.ps1 ${{ matrix.cpu }}
|
||||
.\aria2.ps1 ${{ matrix.cpu }}
|
||||
working-directory: ./script
|
||||
- name: Package
|
||||
run: |
|
||||
pupnet DownKyi.pupnet.conf --app-version ${{ steps.version.outputs.content }} --kind ${{ matrix.kind }} -r win-${{ matrix.cpu }} -y
|
||||
working-directory: ./script/pupnet
|
||||
- name: Upload build artifacts ${{ matrix.kind }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DownKyi-${{ steps.version.outputs.content }}-1.win-${{ matrix.cpu }}.${{ matrix.kind }}
|
||||
path: script/pupnet/output/DownKyi-${{ steps.version.outputs.content }}-1.win-${{ matrix.cpu }}.${{ matrix.kind }}
|
||||
- name: Release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts: script/pupnet/output/DownKyi-${{ steps.version.outputs.content }}-1.win-${{ matrix.cpu }}.${{ matrix.kind }}
|
||||
build-linux:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
cpu: [ x64 ]
|
||||
kind: [ AppImage, deb, rpm ]
|
||||
include:
|
||||
- kind: AppImage
|
||||
cpu: x64
|
||||
package-tail: .x86_64
|
||||
- kind: deb
|
||||
cpu: x64
|
||||
package-tail: .x86_64
|
||||
- kind: rpm
|
||||
cpu: x64
|
||||
package-tail: .x86_64
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: |
|
||||
6.0.x
|
||||
- name: Read Version Text
|
||||
id: version
|
||||
uses: juliangruber/read-file-action@v1
|
||||
with:
|
||||
path: version.txt
|
||||
- name: Install Pupnet
|
||||
run: |
|
||||
dotnet tool install -g KuiperZone.PupNet
|
||||
- name: Get Deps
|
||||
run: |
|
||||
chmod +x ffmpeg.sh
|
||||
chmod +x aria2.sh
|
||||
.\ffmpeg.sh linux ${{ matrix.cpu }}
|
||||
.\aria2.sh linux-${{ matrix.cpu }}
|
||||
working-directory: ./script
|
||||
- name: Package
|
||||
run: |
|
||||
pupnet DownKyi.pupnet.conf --app-version ${{ steps.version.outputs.content }} --kind ${{ matrix.kind }} -r linux-${{ matrix.cpu }} -y
|
||||
working-directory: ./script/pupnet
|
||||
- name: Upload build artifacts ${{ matrix.kind }}
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DownKyi-${{ steps.version.outputs.content }}-1.${{ matrix.package-tail }}.${{ matrix.kind }}
|
||||
path: script/pupnet/output/DownKyi-${{ steps.version.outputs.content }}-1.${{ matrix.package-tail }}.${{ matrix.kind }}
|
||||
- name: Release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts: script/pupnet/output/DownKyi-${{ steps.version.outputs.content }}-1.${{ matrix.package-tail }}.${{ matrix.kind }}
|
||||
build-macos:
|
||||
runs-on: macos-latest
|
||||
strategy:
|
||||
matrix:
|
||||
cpu: [ x64, arm64 ]
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
- name: Install Tool Via HomeBrew
|
||||
run: |
|
||||
export HOMEBREW_NO_AUTO_UPDATE=true
|
||||
export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=true
|
||||
brew install create-dmg tree
|
||||
- name: Install .NET
|
||||
uses: actions/setup-dotnet@v3
|
||||
with:
|
||||
dotnet-version: |
|
||||
6.0.x
|
||||
- name: Read Version Text
|
||||
id: version
|
||||
uses: juliangruber/read-file-action@v1
|
||||
with:
|
||||
path: version.txt
|
||||
- name: Get Deps
|
||||
run: |
|
||||
chmod +x ffmpeg.sh
|
||||
.\ffmpeg.ps1 mac ${{ matrix.cpu }}
|
||||
- name: Build ${{ matrix.cpu }}
|
||||
run: |
|
||||
dotnet restore
|
||||
dotnet publish DownKyi.csproj --self-contained -r osx-${{ matrix.cpu }} -c Release -p:DebugType=None -p:DebugSymbols=false
|
||||
- name: Package app
|
||||
run: |
|
||||
chmod +x package.sh
|
||||
./package.sh ${{ matrix.cpu }}
|
||||
working-directory: ./script/macos
|
||||
- name: Create DMG
|
||||
run:
|
||||
create-dmg \
|
||||
--hdiutil-quiet \
|
||||
--icon "哔哩下载姬.app" 165 175 \
|
||||
--icon-size 120 \
|
||||
--app-drop-link 495 175 \
|
||||
--window-size 660 400 \
|
||||
"DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg" "./哔哩下载姬.app"
|
||||
working-directory: ./script/macos
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg
|
||||
path: script/macos/DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg
|
||||
- name: Release
|
||||
uses: ncipollo/release-action@v1
|
||||
if: ${{ startsWith(github.ref, 'refs/tags/') }}
|
||||
with:
|
||||
allowUpdates: true
|
||||
artifacts: script/macos/DownKyi-${{ steps.version.outputs.content }}-osx-${{ matrix.cpu }}.dmg
|
||||
4
.gitignore
vendored
4
.gitignore
vendored
@@ -7,12 +7,12 @@
|
||||
*/**/bin
|
||||
|
||||
DownKyi.Core/Binary/*
|
||||
!DownKyi.Core/Binary/osx-x64
|
||||
!DownKyi.Core/Binary/osx-arm64
|
||||
!DownKyi.Core/Binary/osx-x64/aria2/
|
||||
!DownKyi.Core/Binary/osx-arm64/aria2/
|
||||
|
||||
script/downloads
|
||||
script/pupnet/output
|
||||
script/macos/*.dmg
|
||||
script/macos/*.app
|
||||
|
||||
*.sln.DotSettings.user
|
||||
30
script/aria2.sh
Executable file
30
script/aria2.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
download_dir="./downloads"
|
||||
save_path="../DownKyi.Core/Binary"
|
||||
|
||||
if [ ! -d "$download_dir" ]; then
|
||||
mkdir "$download_dir"
|
||||
fi
|
||||
|
||||
create_dir() {
|
||||
if [ ! -d "$1" ]; then
|
||||
mkdir -p "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
download_aria2() {
|
||||
local download_url
|
||||
local save
|
||||
case $1 in
|
||||
linux-x64)
|
||||
save="$save_path/$1/aria2"
|
||||
download_url="https://github.com/abcfy2/aria2-static-build/releases/download/1.37.0/aria2-x86_64-linux-musl_static.zip"
|
||||
;;
|
||||
esac
|
||||
|
||||
curl -kL "$download_url" -o "$download_dir/aria2.zip"
|
||||
create_dir "$save"
|
||||
unzip -d "$save" "$download_dir/aria2.zip"
|
||||
}
|
||||
|
||||
download_aria2 "$@"
|
||||
50
script/ffmpeg.sh
Executable file
50
script/ffmpeg.sh
Executable file
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
os=$1
|
||||
arch=$2
|
||||
|
||||
ffmpeg_save_path="../DownKyi.Core/Binary"
|
||||
download_dir="./downloads"
|
||||
|
||||
create_dir() {
|
||||
if [ ! -d "$1" ]; then
|
||||
mkdir -p "$1"
|
||||
fi
|
||||
}
|
||||
|
||||
download_ffmpeg_macos() {
|
||||
local url="https://github.com/eugeneware/ffmpeg-static/releases/download/b4.4.1/darwin-$arch"
|
||||
create_dir "$ffmpeg_save_path/osx-$arch/ffmpeg"
|
||||
curl -kL "$url" -o "$ffmpeg_save_path/osx-$arch/ffmpeg/ffmpeg"
|
||||
chmod +x "$ffmpeg_save_path/osx-$arch/ffmpeg/ffmpeg"
|
||||
}
|
||||
|
||||
download_ffmpeg_linux() {
|
||||
local realArch=""
|
||||
case $arch in
|
||||
x64)
|
||||
realArch="amd64"
|
||||
;;
|
||||
arm64)
|
||||
realArch="arm64"
|
||||
;;
|
||||
esac
|
||||
output=$ffmpeg_save_path/linux-x64/ffmpeg
|
||||
local url="https://www.johnvansickle.com/ffmpeg/old-releases/ffmpeg-4.4.1-${realArch}-static.tar.xz"
|
||||
if [ ! -f "ffmpeg.tar.xz" ]; then
|
||||
curl -kL $url -o "${download_dir}/ffmpeg.tar.xz"
|
||||
fi
|
||||
|
||||
if [ ! -d "$output" ]; then
|
||||
mkdir -p "$output"
|
||||
fi
|
||||
tar -xf "${download_dir}/ffmpeg.tar.xz" --strip-components 1 -C "$output" '*/ffmpeg'
|
||||
chmod +x "$output/ffmpeg"
|
||||
}
|
||||
|
||||
if [ "$os" == "mac" ]; then
|
||||
download_ffmpeg_macos
|
||||
elif [ "$os" == "linux" ]; then
|
||||
download_ffmpeg_linux
|
||||
else
|
||||
echo "不支持的操作系统"
|
||||
fi
|
||||
@@ -1,14 +1,13 @@
|
||||
#!/bin/bash
|
||||
arch=$1
|
||||
APP_NAME="./哔哩下载姬.app"
|
||||
DMG_NAME="./DownKyi.dmg"
|
||||
PUBLISH_OUTPUT_DIRECTORY="../../DownKyi/bin/Release/net6.0/osx-x64/publish/."
|
||||
PUBLISH_OUTPUT_DIRECTORY="../../DownKyi/bin/Release/net6.0/osx-$arch/publish/."
|
||||
|
||||
INFO_PLIST="./Info.plist"
|
||||
ICON_FILE="./logo.icns"
|
||||
|
||||
if [ -d "$APP_NAME" ]
|
||||
then
|
||||
rm -rf "$APP_NAME"
|
||||
if [ -d "$APP_NAME" ]; then
|
||||
rm -rf "$APP_NAME"
|
||||
fi
|
||||
|
||||
mkdir "$APP_NAME"
|
||||
@@ -20,5 +19,3 @@ mkdir "$APP_NAME/Contents/Resources"
|
||||
cp "$INFO_PLIST" "$APP_NAME/Contents/Info.plist"
|
||||
cp "$ICON_FILE" "$APP_NAME/Contents/Resources/$ICON_FILE"
|
||||
cp -a "$PUBLISH_OUTPUT_DIRECTORY" "$APP_NAME/Contents/MacOS"
|
||||
|
||||
create-dmg --hdiutil-quiet --icon "哔哩下载姬.app" 165 175 --icon-size 120 --app-drop-link 495 175 --window-size 660 400 $DMG_NAME $APP_NAME
|
||||
@@ -6,11 +6,11 @@ AppShortSummary = Cross-platform deployment utility which packages your .NET pro
|
||||
|
||||
AppLicenseId = GPL-3.0-or-later
|
||||
AppLicenseFile = ../../LICENSE
|
||||
OutputDirectory = output/
|
||||
|
||||
IconFiles = """
|
||||
../../DownKyi/Resources/favicon.ico
|
||||
"""
|
||||
|
||||
DesktopFile = app.desktop
|
||||
# PUBLISHER
|
||||
PublisherName = yaobiao131
|
||||
PublisherCopyright = Copyright (C) yaobiao131 2023
|
||||
@@ -19,17 +19,24 @@ PublisherLinkUrl = https://github.com/yaobiao131/downkyicore
|
||||
PublisherEmail = contact@kuiper.zone
|
||||
DotnetProjectPath = ../../
|
||||
|
||||
# Package Out
|
||||
OutputDirectory = output/
|
||||
PackageName = DownKyi
|
||||
|
||||
# AppImage
|
||||
AppImageVersionOutput = true
|
||||
|
||||
# FLATPAK OPTIONS
|
||||
FlatpakPlatformRuntime = org.freedesktop.Platform
|
||||
FlatpakPlatformSdk = org.freedesktop.Sdk
|
||||
FlatpakPlatformVersion = 22.08
|
||||
FlatpakFinishArgs = """
|
||||
--socket=wayland
|
||||
--socket=x11
|
||||
--filesystem=host
|
||||
--share=network
|
||||
"""
|
||||
FlatpakBuilderArgs =
|
||||
; FlatpakFinishArgs = """
|
||||
; --socket=wayland
|
||||
; --socket=x11
|
||||
; --filesystem=host
|
||||
; --share=network
|
||||
; """
|
||||
; FlatpakBuilderArgs =
|
||||
|
||||
DotnetPublishArgs = -p:Version=${APP_VERSION} --self-contained true -p:DebugType=None -p:DebugSymbols=false
|
||||
|
||||
|
||||
13
script/pupnet/app.desktop
Normal file
13
script/pupnet/app.desktop
Normal file
@@ -0,0 +1,13 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=${APP_FRIENDLY_NAME}
|
||||
Icon=${APP_ID}
|
||||
Comment=${APP_SHORT_SUMMARY}
|
||||
Exec=env LANG=en_US.UTF-8 ${INSTALL_EXEC}
|
||||
TryExec=${INSTALL_EXEC}
|
||||
NoDisplay=${DESKTOP_NODISPLAY}
|
||||
X-AppImage-Integrate=${DESKTOP_INTEGRATE}
|
||||
Terminal=${DESKTOP_TERMINAL}
|
||||
Categories=${PRIME_CATEGORY}
|
||||
MimeType=
|
||||
Keywords=
|
||||
1
version.txt
Normal file
1
version.txt
Normal file
@@ -0,0 +1 @@
|
||||
1.0.0
|
||||
Reference in New Issue
Block a user