Skip to content

Commit 417c490

Browse files
committed
测试发布
1 parent 74da419 commit 417c490

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

.github/workflows/nuget-publish.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ env:
1818

1919
jobs:
2020
build-and-test:
21-
runs-on: ubuntu-latest
21+
runs-on: windows-latest
2222

2323
steps:
2424
- name: Checkout code
@@ -32,13 +32,13 @@ jobs:
3232
dotnet-version: ${{ env.DOTNET_VERSION }}
3333

3434
- name: Restore dependencies
35-
run: dotnet restore src/CodeRegion.sln
35+
run: dotnet restore CodeRegion.slnx
3636

3737
- name: Build Source Generator
38-
run: dotnet build ${{ env.SOURCE_GENERATOR_PATH }} --configuration Release --no-restore
38+
run: dotnet build ${{ env.SOURCE_GENERATOR_PATH }} --configuration Release --no-restore --framework netstandard2.0
3939

4040
- name: Build project
41-
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
41+
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore --framework netstandard2.0
4242

4343
- name: Run tests (if any)
4444
run: dotnet test src/ --configuration Release --no-build --verbosity normal --collect:"XPlat Code Coverage"
@@ -55,7 +55,7 @@ jobs:
5555

5656
publish-nuget:
5757
needs: build-and-test
58-
runs-on: ubuntu-latest
58+
runs-on: windows-latest
5959
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
6060

6161
steps:
@@ -72,16 +72,16 @@ jobs:
7272

7373
- name: Publish NuGet package
7474
run: |
75-
dotnet nuget push ./packages/*.nupkg \
76-
--api-key ${{ secrets.NUGET_API_KEY }} \
77-
--source https://api.nuget.org/v3/index.json \
75+
dotnet nuget push ./packages/*.nupkg `
76+
--api-key ${{ secrets.NUGET_API_KEY }} `
77+
--source https://api.nuget.org/v3/index.json `
7878
--skip-duplicate
7979
env:
8080
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
8181

8282
publish-github:
8383
needs: build-and-test
84-
runs-on: ubuntu-latest
84+
runs-on: windows-latest
8585
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
8686

8787
steps:
@@ -98,9 +98,9 @@ jobs:
9898

9999
- name: Publish to GitHub Packages
100100
run: |
101-
dotnet nuget push ./packages/*.nupkg \
102-
--api-key ${{ secrets.GITHUB_TOKEN }} \
103-
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \
101+
dotnet nuget push ./packages/*.nupkg `
102+
--api-key ${{ secrets.GITHUB_TOKEN }} `
103+
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
104104
--skip-duplicate
105105
env:
106106
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ env:
1212

1313
jobs:
1414
release:
15-
runs-on: ubuntu-latest
15+
runs-on: windows-latest
1616

1717
steps:
1818
- name: Checkout code
@@ -27,20 +27,20 @@ jobs:
2727

2828
- name: Get version from tag
2929
id: get_version
30-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
30+
run: echo "VERSION=$($env:GITHUB_REF -replace 'refs/tags/v','')" >> $env:GITHUB_OUTPUT
3131

3232
- name: Update version in Directory.Build.props
3333
run: |
34-
sed -i "s/<Version>.*<\/Version>/<Version>${{ steps.get_version.outputs.VERSION }}<\/Version>/" src/Directory.Build.props
34+
(Get-Content Directory.Build.props) -replace '<Version>.*</Version>', '<Version>${{ steps.get_version.outputs.VERSION }}</Version>' | Set-Content Directory.Build.props
3535
3636
- name: Restore dependencies
37-
run: dotnet restore src/CodeRegion.sln
37+
run: dotnet restore CodeRegion.slnx
3838

3939
- name: Build Source Generator
40-
run: dotnet build ${{ env.SOURCE_GENERATOR_PATH }} --configuration Release --no-restore
40+
run: dotnet build ${{ env.SOURCE_GENERATOR_PATH }} --configuration Release --no-restore --framework netstandard2.0
4141

4242
- name: Build project
43-
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore
43+
run: dotnet build ${{ env.PROJECT_PATH }} --configuration Release --no-restore --framework netstandard2.0
4444

4545
- name: Pack NuGet package
4646
run: dotnet pack ${{ env.PROJECT_PATH }} --configuration Release --no-build --output ./packages
@@ -55,16 +55,16 @@ jobs:
5555

5656
- name: Publish to NuGet.org
5757
run: |
58-
dotnet nuget push ./packages/*.nupkg \
59-
--api-key ${{ secrets.NUGET_API_KEY }} \
60-
--source https://api.nuget.org/v3/index.json \
58+
dotnet nuget push ./packages/*.nupkg `
59+
--api-key ${{ secrets.NUGET_API_KEY }} `
60+
--source https://api.nuget.org/v3/index.json `
6161
--skip-duplicate
6262
6363
- name: Publish to GitHub Packages
6464
run: |
65-
dotnet nuget push ./packages/*.nupkg \
66-
--api-key ${{ secrets.GITHUB_TOKEN }} \
67-
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \
65+
dotnet nuget push ./packages/*.nupkg `
66+
--api-key ${{ secrets.GITHUB_TOKEN }} `
67+
--source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json `
6868
--skip-duplicate
6969
env:
7070
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)