Skip to content

Commit d3648f6

Browse files
authored
Merge pull request #1 from pregress/release-action
Release pipeline
2 parents f82abb1 + e438464 commit d3648f6

File tree

3 files changed

+75
-2
lines changed

3 files changed

+75
-2
lines changed

.github/workflows/release.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*' # This workflow runs when a tag is pushed that starts with 'v'
7+
8+
jobs:
9+
release:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Setup .NET
15+
uses: actions/setup-dotnet@v4
16+
with:
17+
dotnet-version: 8.0.x
18+
19+
- name: Set up Git for tagging
20+
run: |
21+
git config user.name "github-actions"
22+
git config user.email "[email protected]"
23+
24+
- name: Extract version from tag
25+
id: get_version
26+
run: |
27+
echo "##[set-output name=version;]${GITHUB_REF##*/}"
28+
29+
- name: Update Assembly and NuGet package version
30+
run: |
31+
version=${{ steps.get_version.outputs.version }}
32+
echo "Updating Assembly and NuGet package versions to ${version}"
33+
sed -i "s/<VersionPrefix>.*<\/VersionPrefix>/<VersionPrefix>${version}<\/VersionPrefix>/g" ./src/ApimSanitizer.csproj
34+
sed -i "s/\[assembly: AssemblyVersion(\".*\"\]/[assembly: AssemblyVersion(\"${version}\")]/g" ./src/Properties/AssemblyInfo.cs
35+
sed -i "s/\[assembly: AssemblyFileVersion(\".*\"\]/[assembly: AssemblyFileVersion(\"${version}\")]/g" ./src/Properties/AssemblyInfo.cs
36+
37+
- name: Build the project
38+
run: dotnet build --configuration Release
39+
40+
- name: Pack the NuGet package
41+
run: dotnet pack --configuration Release --output ./artifacts
42+
43+
- name: Upload build artifacts
44+
uses: actions/upload-artifact@v3
45+
with:
46+
name: nuget-package
47+
path: ./artifacts/*.nupkg
48+
49+
- name: Create GitHub Release
50+
uses: actions/create-release@v1
51+
with:
52+
tag_name: ${{ steps.get_version.outputs.version }}
53+
release_name: Release ${{ steps.get_version.outputs.version }}
54+
body: |
55+
Release version ${{ steps.get_version.outputs.version }}.
56+
draft: false
57+
prerelease: false
58+
files: ./artifacts/*.nupkg
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61+
62+
# - name: Push NuGet package to nuget.org
63+
# run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
64+
65+
- name: Push NuGet package to GitHub packages
66+
run: dotnet nuget push ./artifacts/*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json

src/ApimSanitizer.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
</PropertyGroup>
1111

1212
<PropertyGroup>
13-
<PackageId>apimsanitizer</PackageId>
13+
<PackageId>dotnet-apimsanitizer</PackageId>
1414
<Authors>Pregress</Authors>
1515
<Description>Sanitize open api defintion files to import them into Azure APIM.</Description>
1616
<PackageTags>azure;apim;tool</PackageTags>
1717
<PackageReadmeFile>GlobalTool.md</PackageReadmeFile>
1818
<PackageReleaseNotes>https://github.com/pregress/ApimSanitizer/blob/main/Documentation/Changelog.md</PackageReleaseNotes>
1919
<PackageIconUrl>https://github.com/pregress/ApimSanitizer/blob/main/_assets/icon.png</PackageIconUrl>
20-
<PackageIcon>icon.png</PackageIcon>
20+
<PackageIcon>coverlet-icon.png</PackageIcon>
2121
<PackageProjectUrl>https://github.com/pregress/ApimSanitizer</PackageProjectUrl>
2222
<PackageLicenseExpression>MIT</PackageLicenseExpression>
2323
<RepositoryType>git</RepositoryType>

src/Properties/AssemblyInfo.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
using System.Reflection;
2+
using System.Runtime.InteropServices;
3+
4+
5+
[assembly: ComVisible(false)]
6+
[assembly: AssemblyVersion("1.0.0.0")]
7+
[assembly: AssemblyFileVersion("1.0.0.0")]

0 commit comments

Comments
 (0)