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
|
||||
Reference in New Issue
Block a user