Skip to content

Commit 1b5c204

Browse files
authored
Merge pull request #2 from stesee/automated-nuget.org-publish
Automated nuget.org publish
2 parents 59b92b3 + b188f58 commit 1b5c204

File tree

2 files changed

+41
-6
lines changed

2 files changed

+41
-6
lines changed

.github/workflows/dotnet.yml

Lines changed: 40 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
name: .NET build and test
2+
env:
3+
LAST_COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
24

35
on:
46
push:
5-
branches: [ main, automated-nuget.org-publish ]
67
pull_request:
7-
branches: [ main, automated-nuget.org-publish ]
88

99
jobs:
1010
build:
@@ -29,10 +29,10 @@ jobs:
2929
echo "done!"
3030
pwd
3131
32-
deploy:
32+
deployMain:
33+
if: github.ref == 'refs/heads/main'
3334
runs-on: ubuntu-latest
3435
needs: build
35-
if: github.ref == 'refs/heads/master'
3636
steps:
3737
- uses: actions/checkout@v2
3838
- name: Setup .NET
@@ -48,7 +48,8 @@ jobs:
4848
- name: NugetPush
4949
run: |
5050
ls ./GithubActionsHelloWorld/bin/Release
51-
dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.*nupkg --skip-duplicate --include-symbols -p:SymbolPackageFormat=snupkg --api-key ${{secrets.NUGET_TOKEN}} --source https://int.nugettest.org/
51+
dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
52+
# dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://api.nuget.org/v3/index.json
5253
- uses: papeloto/action-zip@v1
5354
with:
5455
files: ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
@@ -57,8 +58,41 @@ jobs:
5758
with:
5859
repo_token: "${{ secrets.GITHUB_TOKEN }}"
5960
automatic_release_tag: "latest"
61+
title: "Release Build"
62+
files: |
63+
LICENSE
64+
GithubActionsHelloWorld.zip
65+
66+
deployTest:
67+
if: github.ref != 'refs/heads/main'
68+
runs-on: ubuntu-latest
69+
needs: build
70+
steps:
71+
- uses: actions/checkout@v2
72+
- name: Setup .NET
73+
uses: actions/setup-dotnet@v1
74+
with:
75+
dotnet-version: 6.0.x
76+
- name: Restore dependencies
77+
run: dotnet restore
78+
- name: Build
79+
run: dotnet build --configuration Release --no-restore
80+
- name: Publish
81+
run: dotnet publish --configuration Release --no-restore
82+
- name: NugetPush
83+
run: |
84+
ls ./GithubActionsHelloWorld/bin/Release
85+
dotnet nuget push ./GithubActionsHelloWorld/bin/Release/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_TOKEN}} --source https://apiint.nugettest.org/v3/index.json
86+
- uses: papeloto/action-zip@v1
87+
with:
88+
files: ./GithubActionsHelloWorld/bin/Release/net6.0/publish/
89+
dest: GithubActionsHelloWorld.zip
90+
- uses: "marvinpinto/action-automatic-releases@latest"
91+
with:
92+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
93+
automatic_release_tag: "latest-prerelease"
6094
prerelease: true
61-
title: "Development Build"
95+
title: "Prerelease Build"
6296
files: |
6397
LICENSE
6498
GithubActionsHelloWorld.zip

GithubActionsHelloWorld/GithubActionsHelloWorld.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<IncludeSymbols>true</IncludeSymbols>
1313
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1414
<PackageId>GithubActionsHelloWorld</PackageId>
15+
<PackageReleaseNotes>$(LAST_COMMIT_MESSAGE)</PackageReleaseNotes>
1516
</PropertyGroup>
1617

1718
</Project>

0 commit comments

Comments
 (0)