Skip to content

本地aria2首次启动时增加3s延时检测是否可连接 #53

本地aria2首次启动时增加3s延时检测是否可连接

本地aria2首次启动时增加3s延时检测是否可连接 #53

Workflow file for this run

name: .NET Core Desktop
on:
push:
tags:
- '*'
jobs:
build:
runs-on: windows-latest
name: Dotnet Build
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.x'
- name: Determine Pre-release Status
id: prerelease
run: |
$ref = "${{ github.ref }}"
if ($ref -like "*alpha*") {
echo "##[set-output name=status;]true"
} else {
echo "##[set-output name=status;]false"
}
shell: powershell
- name: Echo tag
run: echo The tag is ${{ github.event.inputs.tag }}
- name: Clean
run: dotnet clean $env:GITHUB_WORKSPACE\Aria2Fast.sln --configuration Release && dotnet nuget locals all --clear
- name: Restore dependencies
run: dotnet restore
- name: Set Version
run: powershell -Command "(gc $env:GITHUB_WORKSPACE\Aria2Fast\Utils\ActionVersion.cs) -replace '{VERSION}', '$env:GITHUB_REF_NAME' | Out-File $env:GITHUB_WORKSPACE\Aria2Fast\Utils\ActionVersion.cs"
- name: Set Build
run: powershell -Command "(gc $env:GITHUB_WORKSPACE\Aria2Fast\Utils\ActionVersion.cs) -replace '{BUILD}', '$env:GITHUB_RUN_NUMBER' | Out-File $env:GITHUB_WORKSPACE\Aria2Fast\Utils\ActionVersion.cs"
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Publish
run: dotnet publish -c Release -r win-x64 --self-contained=true
- run: powershell curl https://github.com/aiqinxuancai/DotNetDllPathPatcherWPF/releases/download/v0.0.15/DotNetDllPathPatcherCMD.zip -o DotNetDllPathPatcherCMD.zip
- run: powershell Expand-Archive -Path .\DotNetDllPathPatcherCMD.zip -DestinationPath .\DotNetDllPathPatcherCMD
- run: powershell .\DotNetDllPathPatcherCMD\publish\DotNetDllPathPatcherCMD.exe $env:GITHUB_WORKSPACE\Aria2Fast\bin\Release\net8.0-windows\win-x64\publish\Aria2Fast.exe
# 下载并解压aria2
- name: Download and Extract Aria2
run: |
$tempDir = "$env:GITHUB_WORKSPACE\aria2_temp"
$ariaPath = "$env:GITHUB_WORKSPACE\Aria2Fast\bin\Release\net8.0-windows\win-x64\publish\Aria2"
New-Item -ItemType Directory -Force -Path $ariaPath
Invoke-WebRequest -Uri "https://github.com/aria2/aria2/releases/download/release-1.37.0/aria2-1.37.0-win-64bit-build1.zip" -OutFile "aria2.zip"
Expand-Archive -Path "aria2.zip" -DestinationPath $tempDir
Get-ChildItem -Path $tempDir\aria2-1.37.0-win-64bit-build1\* | Move-Item -Destination $ariaPath
Remove-Item -Path $tempDir -Recurse -Force
shell: powershell
- name: Compress
run: powershell Compress-Archive -Path $env:GITHUB_WORKSPACE\Aria2Fast\bin\Release\net8.0-windows\win-x64\publish -DestinationPath .\Aria2Fast.zip
- name: Process tag and rename file
id: processTag
run: |
$tagStr="$(echo "${{ github.ref }}" | cut -d / -f 3)"
$newName="Aria2Fast-$tagStr.zip"
echo "$newName"
echo "##[set-output name=tag;]$tagStr"
Rename-Item -Path .\Aria2Fast.zip -NewName $newName
shell: powershell
- name: Create a Release
uses: ncipollo/release-action@v1
with:
artifacts: "Aria2Fast-${{ steps.processTag.outputs.tag }}.zip"
prerelease: ${{ steps.prerelease.outputs.status }}
token: ${{ secrets.GITHUB_TOKEN }}