Skip to content

Commit

Permalink
添加macOS&Windows自动构建
Browse files Browse the repository at this point in the history
  • Loading branch information
mujianwu committed Sep 17, 2024
1 parent 94dc078 commit a08b5f4
Show file tree
Hide file tree
Showing 3 changed files with 136 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
workflow_dispatch:
inputs:
VERSION:
description: 'version'
description: 'Version'
required: true
BINARY_BRANCH:
description: 'Binary branch'
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Build macOS

on:
workflow_dispatch:
inputs:
VERSION:
description: 'Version'
required: true
BINARY_BRANCH:
description: 'Binary branch'
required: true
NEED_NUPKG:
description: 'Use self nupkg'
type: boolean
required: true
default: false

jobs:
linux-deb:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Download NuGet package
if: ${{ inputs.NEED_NUPKG }}
run: |
wget https://github.com/Uotan-Dev/SukiUI-Uotan/releases/download/v6.0.0/SukiUI.6.0.0.nupkg
pwd
dotnet nuget add source "/home/runner/work/UotanToolboxNT"
nuget add SukiUI.6.0.0.nupkg -Source /home/runner/work/UotanToolboxNT
- name: Clone Binary
run: git clone https://github.com/Uotan-Dev/UotanToolboxNT.Binary.git -b ${{ inputs.BINARY_BRANCH }}

- name: Build
run: |
dotnet publish -r osx-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-x64
dotnet publish -r osx-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-arm64
- name: Make app-x64
run: |
mkdir UotanToolbox.app
mkdir UotanToolbox.app/Contents
mkdir UotanToolbox.app/Contents/MacOS
mkdir UotanToolbox.app/Contents/Resources
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Info.plist ./UotanToolbox.app/Contents/Info.plist
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/PkgInfo ./UotanToolbox.app/Contents/PkgInfo
cp /home/runner/work/UotanToolboxNT/UotanToolboxNT/UotanToolbox/Assets/Icon.icns ./UotanToolbox.app/Contents/Resources/Icon.icns
cp -r ./UotanToolboxNT.Binary/macOS/* ./UotanToolbox.app/Contents/MacOS/
cp -r ./publish-x64/* ./UotanToolbox.app/Contents/MacOS/
zip -rq ./UotanToolbox_macOS_x64_${{ inputs.VERSION }}.zip ./UotanToolbox.app
rm -rf ./UotanToolbox.app/Contents/MacOS/*
- name: Make app-arm64
run: |
cp -r ./UotanToolboxNT.Binary/macOS/* ./UotanToolbox.app/Contents/MacOS/
cp -r ./publish-arm64/* ./UotanToolbox.app/Contents/MacOS/
zip -rq ./UotanToolbox_macOS_arm64_${{ inputs.VERSION }}.zip ./UotanToolbox.app
rm -rf ./UotanToolbox.app/Contents/MacOS/*
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Linux-Package
path: ./UotanToolbox_macOS*
62 changes: 62 additions & 0 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net

name: Build Windows

on:
workflow_dispatch:
inputs:
VERSION:
description: 'Version'
required: true
BINARY_BRANCH:
description: 'Binary branch'
required: true
NEED_NUPKG:
description: 'Use self nupkg'
type: boolean
required: true
default: false

jobs:
linux-deb:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x

- name: Download NuGet package
if: ${{ inputs.NEED_NUPKG }}
run: |
wget https://github.com/Uotan-Dev/SukiUI-Uotan/releases/download/v6.0.0/SukiUI.6.0.0.nupkg
cd
dotnet nuget add source "/home/runner/work/UotanToolboxNT"
nuget add SukiUI.6.0.0.nupkg -Source /home/runner/work/UotanToolboxNT
- name: Clone Binary
run: git clone https://github.com/Uotan-Dev/UotanToolboxNT.Binary.git -b ${{ inputs.BINARY_BRANCH }}

- name: Build
run: |
dotnet publish -r windows-x64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-x64
dotnet publish -r windows-arm64 --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -o ./publish-arm64
- name: Make zip-x64
run: |
xcopy ./UotanToolboxNT.Binary/Windows\* ./publish-x64 /e
7z a -tzip UotanToolbox_Windows_x64_${{ inputs.VERSION }}.zip -mx=9 -m0=lzma -md=64m -mfb=64 ./publish-x64
- name: Make zip-arm64
run: |
xcopy ./UotanToolboxNT.Binary/Windows\* ./publish-arm64 /e
7z a -tzip UotanToolbox_Windows_arm64_${{ inputs.VERSION }}.zip -mx=9 -m0=lzma -md=64m -mfb=64 ./publish-arm64
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Linux-Package
path: ./UotanToolbox_Windows*

0 comments on commit a08b5f4

Please sign in to comment.