Skip to content

Commit cf126d1

Browse files
authored
Publish only on new Github Releases (Git tags) (#6)
* Add task to publish TestsRuleset along the main package and change GitVersion * Create CI action * Remove Azure DevOps pipeline file
1 parent 0182c21 commit cf126d1

4 files changed

Lines changed: 60 additions & 55 deletions

File tree

.github/workflows/dotnet-publish.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@
22
name: Publish NuGet package
33

44
on:
5-
workflow_dispatch:
65
push:
7-
branches:
8-
- main
6+
tags:
7+
- 'v*.*.*'
8+
workflow_dispatch:
9+
910
env:
1011
ARTIFACTS_FEED_URL: https://api.nuget.org/v3/index.json
1112
DOTNET_VERSION: "6.x"
@@ -43,12 +44,13 @@ jobs:
4344
- name: Setup NuGet.exe for use with actions
4445
uses: NuGet/setup-nuget@v1.0.5
4546

46-
# Run dotnet pack
47-
- name: dotnet build and publish
48-
run: "nuget pack Neolution.CodeAnalysis.nuspec"
47+
- name: Pack main package
48+
run: nuget pack Neolution.CodeAnalysis.nuspec
49+
50+
- name: Pack TestsRuleset package
51+
run: nuget pack Neolution.CodeAnalysis.TestsRuleset.nuspec
4952

50-
# Publish the package to Nuget.org
51-
- name: "dotnet publish"
53+
- name: Push all packages
5254
run: dotnet nuget push --skip-duplicate -k $NUGET_AUTH_TOKEN **/*.nupkg
5355
env:
5456
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_API_KEY_NEOLUTION }}

.github/workflows/dotnet.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
workflow_dispatch:
9+
10+
env:
11+
DOTNET_VERSION: "6.x"
12+
13+
jobs:
14+
publish:
15+
name: build & pack
16+
runs-on: ubuntu-latest
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0 # Needed for GitVersion to function correctly
22+
23+
# Setup .NET Core SDK
24+
- name: Setup .NET Core
25+
uses: actions/setup-dotnet@v1
26+
with:
27+
dotnet-version: ${{ env.DOTNET_VERSION }}
28+
29+
- name: Install GitVersion
30+
uses: gittools/actions/gitversion/setup@v0.9.7
31+
with:
32+
versionSpec: '5.x'
33+
34+
- name: Determine Version
35+
uses: gittools/actions/gitversion/execute@v0.9.7
36+
37+
- name: Replace version number
38+
run: 'sed -i -e "s/{{NuGetVersion}}/$GITVERSION_NUGETVERSION/g" *.nuspec **/*.targets'
39+
40+
- name: Setup NuGet.exe for use with actions
41+
uses: NuGet/setup-nuget@v1.0.5
42+
43+
- name: Pack main package
44+
run: nuget pack Neolution.CodeAnalysis.nuspec
45+
46+
- name: Pack TestsRuleset package
47+
run: nuget pack Neolution.CodeAnalysis.TestsRuleset.nuspec
48+

GitVersion.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
mode: Mainline
1+
mode: ContinuousDelivery
22
branches:
3-
release:
3+
feature:
44
mode: ContinuousDeployment
55
ignore:
66
sha: []

azure-pipelines.yml

Lines changed: 0 additions & 45 deletions
This file was deleted.

0 commit comments

Comments
 (0)