Skip to content

Commit

Permalink
测试打包
Browse files Browse the repository at this point in the history
  • Loading branch information
SilverIceKey committed Jul 4, 2024
1 parent d644ee0 commit af361bc
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ jobs:
- name: Restore dependencies
run: dotnet restore

- name: Extract version from .csproj
id: version
run: |
$version = [xml](Get-Content ./ZYZ-CSharp-Extension.csproj)
$projectVersion = $version.Project.PropertyGroup.Version
echo "PROJECT_VERSION=$projectVersion" >> $GITHUB_ENV
echo "::set-output name=project_version::$projectVersion"
shell: pwsh

- name: Build and generate NuGet package
run: dotnet build --configuration Release --output ${{ github.workspace }}/build
# 构建的同时生成 NuGet 包,因为 GeneratePackageOnBuild 设置为 True
Expand All @@ -38,8 +47,8 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release v${{ github.run_number }}
tag_name: v${{ steps.version.outputs.project_version }}
release_name: Release v${{ steps.version.outputs.project_version }}
draft: false
prerelease: false

Expand All @@ -49,8 +58,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build/*.nupkg
asset_name: ZYZ_CSharp_Extension-${{ github.run_number }}.nupkg
asset_path: ${{ github.workspace }}/build/ZYZ_CSharp_Extension${{ steps.version.outputs.project_version }}.nupkg
asset_name: ZYZ_CSharp_Extension-${{ steps.version.outputs.project_version }}.nupkg
asset_content_type: application/zip

- name: Upload Release Asset (DLL files)
Expand All @@ -59,6 +68,6 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ github.workspace }}/build/*.dll
asset_name: ZYZ_CSharp_Extension-${{ github.run_number }}.dll
asset_path: ${{ github.workspace }}/build/ZYZ_CSharp_Extension.dll
asset_name: ZYZ_CSharp_Extension-${{ steps.version.outputs.project_version }}.dll
asset_content_type: application/octet-stream
2 changes: 1 addition & 1 deletion Net/Http/HttpClientWrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ namespace ZYZ_CSharp_Extension.Net.Http
{
public class HttpClientWrapper
{
//private HttpClient httpClient;
private HttpClient httpClient;

Check warning on line 11 in Net/Http/HttpClientWrapper.cs

View workflow job for this annotation

GitHub Actions / build_and_release

Non-nullable field 'httpClient' must contain a non-null value when exiting constructor. Consider declaring the field as nullable.

Check warning on line 11 in Net/Http/HttpClientWrapper.cs

View workflow job for this annotation

GitHub Actions / build_and_release

The field 'HttpClientWrapper.httpClient' is never used
}
}

0 comments on commit af361bc

Please sign in to comment.