Skip to content

Commit 87d402e

Browse files
Convert CI to GitHub Actions with NuGet publishing; remove package publishing from Azure Pipelines (#229)
* Initial plan * Convert CI to GitHub Actions and remove package publishing from Azure Pipelines Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com> * Add workflow_dispatch trigger and NuGet publish to GitHub Actions workflow Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com> * Change GitHub Actions runner from ubuntu-latest to windows-latest Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: 304NotModified <5808377+304NotModified@users.noreply.github.com>
1 parent 15621d4 commit 87d402e

2 files changed

Lines changed: 52 additions & 41 deletions

File tree

.github/workflows/build.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
workflow_dispatch:
9+
10+
jobs:
11+
build:
12+
runs-on: windows-latest
13+
permissions:
14+
contents: read
15+
id-token: write
16+
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- name: Setup .NET
21+
uses: actions/setup-dotnet@v4
22+
with:
23+
dotnet-version: '8.0.x'
24+
25+
- name: Restore
26+
run: dotnet restore src/NLog.MailKit.sln
27+
28+
- name: Build
29+
run: dotnet build src/NLog.MailKit.sln --configuration Release --no-restore
30+
31+
- name: Test
32+
run: dotnet test src/NLog.MailKit.sln --configuration Release --no-build
33+
34+
- name: Pack
35+
run: dotnet pack src/NLog.MailKit.sln --no-build --configuration Release --output artifacts
36+
37+
- name: Upload nuget package
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: nupkg
41+
path: artifacts/*.nupkg
42+
43+
- name: NuGet login
44+
if: github.ref == 'refs/heads/master'
45+
uses: NuGet/login@v1
46+
id: login
47+
with:
48+
user: ${{ secrets.NUGET_USER }}
49+
50+
- name: Push to NuGet.org
51+
if: github.ref == 'refs/heads/master'
52+
run: dotnet nuget push artifacts/*.nupkg --api-key ${{ steps.login.outputs.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate

azure-pipelines.yml

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -60,44 +60,3 @@ steps:
6060

6161
- task: SonarCloudPublish@3
6262
displayName: 'Publish SonarCloud Quality Gate'
63-
64-
- task: CopyFiles@2
65-
displayName: 'Copy Files artifacts'
66-
inputs:
67-
SourceFolder: '$(system.defaultworkingdirectory)'
68-
Contents: |
69-
**\bin\$(BuildConfiguration)\**\*.nupkg
70-
**\bin\$(BuildConfiguration)\**\*.snupkg
71-
TargetFolder: '$(build.artifactstagingdirectory)'
72-
condition: succeededOrFailed()
73-
74-
- task: PublishBuildArtifacts@1
75-
displayName: 'Publish Artifact: packages'
76-
inputs:
77-
PathtoPublish: '$(build.artifactstagingdirectory)'
78-
ArtifactName: packages
79-
condition: succeededOrFailed()
80-
81-
- task: NuGetCommand@2
82-
displayName: 'Push NuGet Package to nuget.org'
83-
inputs:
84-
command: 'push'
85-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' # will also push the snupkg
86-
nuGetFeedType: 'external'
87-
publishFeedCredentials: 'NLog new'
88-
allowPackageConflicts: true
89-
verbosityPush: 'Normal'
90-
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
91-
continueOnError: true
92-
93-
94-
- task: NuGetCommand@2
95-
displayName: 'Push NuGet Package to Azure Devops'
96-
inputs:
97-
command: 'push'
98-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' # will also push the snupkg
99-
nuGetFeedType: 'internal'
100-
publishVstsFeed: 'a6abb58f-ecac-4f57-8990-021064cff0ff/d910ba3f-9900-4b9a-a317-016618781395' # NLog
101-
allowPackageConflicts: true
102-
verbosityPush: 'Normal'
103-
enabled: false # Get error TF400898

0 commit comments

Comments
 (0)