Merge branch 'feature' into feature #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "feature" ] | |
env: | |
ACTIONS_ALLOW_UNSECURE_COMMANDS: true | |
dotnet-version: "8.0" | |
target-version: "net8.0" | |
compile-flags: "--self-contained=true -c Release -p:UseAppHost=true -p:IncludeNativeLibrariesForSelfExtract=true -p:EnableCompressionInSingleFile=true -p:DebugType=None -p:DebugSymbols=false -p:PublishSingleFile=true" | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: "Setup Dotnet" | |
uses: "actions/setup-dotnet@v3" | |
with: | |
dotnet-version: "${{env.dotnet-version}}" | |
- name: Test | |
run: dotnet test WonderLab.Desktop/WonderLab.Desktop.csproj | |
test_build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: "Setup Dotnet" | |
uses: "actions/setup-dotnet@v3" | |
with: | |
dotnet-version: "${{env.dotnet-version}}" | |
- name: Test | |
run: dotnet build WonderLab.Desktop/WonderLab.Desktop.csproj | |
build_Windows: | |
runs-on: windows-latest | |
needs: [test, test_build] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "${{env.dotnet-version}}" | |
- name: Update code | |
shell: cmd | |
working-directory: ./ | |
run: ./.build/update_code.bat | |
- name: Build | |
shell: powershell | |
working-directory: ./ | |
run: ./.build/build_windows.ps1 | |
- name: Upload x64 build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Windows_x64 | |
path: 'WonderLab.Desktop/bin/Release/${{ env.target-version }}/publish/win-x64/*.zip' | |
- name: Upload arm64 build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Windows_arm64 | |
path: 'WonderLab.Desktop/bin/Release/${{ env.target-version }}/publish/win-arm64/*.zip' | |
build_Linux_Appimage: | |
strategy: | |
matrix: | |
arch: ["x64", "arm", "arm64"] | |
runs-on: ubuntu-latest | |
needs: [test, test_build] | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: "Setup Dotnet" | |
uses: "actions/setup-dotnet@v3" | |
with: | |
dotnet-version: "${{env.dotnet-version}}" | |
- name: Install pupnet | |
run: dotnet tool install -g KuiperZone.PupNet | |
- name: Install Linrary | |
run: | | |
sudo add-apt-repository universe | |
sudo apt install libfuse2 | |
- name: Get version | |
id: package_version | |
uses: Blessing-Studio/get-csproj-version@main | |
with: | |
file: WonderLab.Desktop/WonderLab.Desktop.csproj | |
- name: Build | |
run: pupnet --runtime linux-${{ matrix.arch }} --kind appimage -y -o WonderLab.${{ steps.package_version.outputs.version }}.linux-${{ matrix.arch }}.AppImage | |
- name: Upload build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: AppImage | |
path: Deploy/OUT/*.AppImage | |
build_MacOS: | |
runs-on: macos-latest | |
needs: [test, test_build] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: "${{env.dotnet-version}}" | |
- name: Update code | |
shell: bash | |
working-directory: ./ | |
run: | | |
chmod a+x ./.build/update_code.sh | |
./.build/update_code.sh | |
- name: Build | |
shell: bash | |
working-directory: ./ | |
run: | | |
chmod a+x ./.build/build_osx.sh | |
./.build/build_osx.sh | |
- name: Upload x64 build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OSX_x64 | |
path: 'WonderLab.Desktop/bin/Release/${{ env.target-version }}/publish/osx-x64/*.zip' | |
- name: Upload arm64 build artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: OSX_arm64 | |
path: 'WonderLab.Desktop/bin/Release/${{ env.target-version }}/publish/osx-arm64/*.zip' | |
Release: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_REF: $ github.ref | |
needs: [build_Windows, build_MacOS, build_Linux_Appimage] | |
steps: | |
- uses: nelonoel/branch-name@v1 | |
- name: Download Windows-x64 Build | |
uses: actions/download-artifact@v3 | |
with: | |
name: Windows_x64 | |
- name: Download Windows-arm64 Build | |
uses: actions/download-artifact@v3 | |
with: | |
name: Windows_arm64 | |
- name: Download AppImage Build | |
uses: actions/download-artifact@v3 | |
with: | |
name: AppImage | |
- name: Download OSX-x64 Build | |
uses: actions/download-artifact@v3 | |
with: | |
name: OSX_x64 | |
- name: Download OSX-arm64 Build | |
uses: actions/download-artifact@v3 | |
with: | |
name: OSX_arm64 | |
- name: Create Release | |
if: github.event_name != 'pull_request' | |
uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
prerelease: false | |
automatic_release_tag: AutoBuild_${{ env.BRANCH_NAME }} | |
title: "${{ env.BRANCH_NAME }} 分支 - 测试渠道" | |
files: | | |
*.zip | |
*.AppImage | |
Delete_Artifacts: | |
permissions: write-all | |
runs-on: ubuntu-latest | |
needs: [Release] | |
steps: | |
- name: Delete Windows-x64 Artifact | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: Windows_x64 | |
- name: Delete Windows-arm64 Artifact | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: Windows_arm64 | |
- name: Delete OSX-x64 Artifact | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: OSX_x64 | |
- name: Delete OSX-arm64 Artifact | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: OSX_arm64 | |
- name: Delete AppImage Artifact | |
uses: geekyeggo/delete-artifact@v2 | |
with: | |
name: AppImage |