Skip to content

Commit 41ae328

Browse files
committed
GitHub Actions: Improve release
* Take the version from the tag * Upload the artifact Add a build GitHub Actions also
1 parent 7625b11 commit 41ae328

File tree

4 files changed

+69
-8
lines changed

4 files changed

+69
-8
lines changed

.github/workflows/dotnetcore.yml renamed to .github/workflows/build_plugin.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
name: .NET Core
1+
name: Build the plugin
22

33
on:
44
push:
5-
tags:
6-
- 'v*'
5+
branches:
6+
- '**'
7+
tags-ignore:
8+
- '*'
79

810
jobs:
911
build:
@@ -26,7 +28,8 @@ jobs:
2628
msbuild -target:restore -property:Configuration=Release
2729
msbuild -target:pack -property:Configuration=Release
2830
29-
- name: Push to Nuget.org nuget feed
30-
run: |
31-
cd "src/GitExtensions.AzureDevOpsCommitMessage/bin/Release"
32-
dotnet nuget push *.nupkg -k ${{ secrets.NUGET_PUSH_TOKEN }} -s https://api.nuget.org/v3/index.json -n true
31+
- name: Upload artifact
32+
uses: actions/upload-artifact@v1
33+
with:
34+
name: ${{ github.event.repository.name }}.nupkg
35+
path: src/${{ github.event.repository.name }}/bin/Release/${{ github.event.repository.name }}.0.0.0.nupkg

.github/workflows/release_plugin.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release a new version of the plugin
2+
3+
# Release is made by pushin a tag with format 'vX.Y.Z' (ex: v1.0.2)
4+
5+
on:
6+
push:
7+
tags:
8+
- 'v\d.\d.\d'
9+
10+
jobs:
11+
build:
12+
13+
runs-on: [windows-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
18+
- name: Extract version
19+
shell: bash
20+
run: echo "##[set-output name=version;]$(echo ${GITHUB_REF##*/v})"
21+
id: extract_version
22+
23+
- name: Update version in csproj
24+
uses: datamonsters/replace-action@v2
25+
with:
26+
files: 'src/${{ github.event.repository.name }}/${{ github.event.repository.name }}.csproj'
27+
replacements: '<VersionPrefix>0.0.0</VersionPrefix>=<VersionPrefix>${{ steps.extract_version.outputs.version }}</VersionPrefix>'
28+
29+
- name: Setup .NET Core
30+
uses: actions/setup-dotnet@v1
31+
with:
32+
dotnet-version: 2.2.108
33+
34+
- name: Setup MSBuild.exe
35+
uses: warrenbuckley/Setup-MSBuild@v1
36+
37+
- name: Build & package with `msbuild`
38+
run: |
39+
msbuild -target:restore -property:Configuration=Release
40+
msbuild -target:pack -property:Configuration=Release
41+
42+
- name: Upload artifact
43+
uses: actions/upload-artifact@v1
44+
with:
45+
name: ${{ github.event.repository.name }}.nupkg
46+
path: src/${{ github.event.repository.name }}/bin/Release/${{ github.event.repository.name }}.${{ steps.extract_version.outputs.version }}.nupkg
47+
48+
- name: Push to Nuget.org nuget feed
49+
run: |
50+
cd "src/${{ github.event.repository.name }}/bin/Release"
51+
dotnet nuget push *.nupkg -k ${{ secrets.NUGET_PUSH_TOKEN }} -s https://api.nuget.org/v3/index.json -n true

GitExtensions.AzureDevOpsCommitMessage.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ VisualStudioVersion = 15.0.26124.0
55
MinimumVisualStudioVersion = 15.0.26124.0
66
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GitExtensions.AzureDevOpsCommitMessage", "src\GitExtensions.AzureDevOpsCommitMessage\GitExtensions.AzureDevOpsCommitMessage.csproj", "{C5137205-996A-41E9-A3EB-F6DB37F6AE21}"
77
EndProject
8+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{D1376319-B232-4550-99C6-8E9244DC42AF}"
9+
ProjectSection(SolutionItems) = preProject
10+
.github\workflows\build_plugin.yml = .github\workflows\build_plugin.yml
11+
.github\workflows\release_plugin.yml = .github\workflows\release_plugin.yml
12+
EndProjectSection
13+
EndProject
814
Global
915
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1016
Debug|Any CPU = Debug|Any CPU

src/GitExtensions.AzureDevOpsCommitMessage/GitExtensions.AzureDevOpsCommitMessage.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22

33
<PropertyGroup>
44
<TargetFramework>net461</TargetFramework>
5-
<VersionPrefix>1.0.1</VersionPrefix>
5+
<!--Value useless because will be overwritten by release GitHub action. Keep '0.0.0' so that the release process work well!-->
6+
<VersionPrefix>0.0.0</VersionPrefix>
67
<PublishRepositoryUrl>true</PublishRepositoryUrl>
78
</PropertyGroup>
89
<ItemGroup>

0 commit comments

Comments
 (0)