Skip to content

Commit b6b6be2

Browse files
sklivvzclaude
andcommitted
Migrate CI/CD from Azure DevOps to GitHub Actions
- Add build-and-test.yml workflow for PR/push validation - Add publish-nuget.yml workflow with Trusted Publishing (OIDC) - Update versioning to use explicit version instead of BUILD_BUILDID - Add README to NuGet package for better presentation - Bump version to 1.5.0 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 9b70205 commit b6b6be2

File tree

3 files changed

+120
-8
lines changed

3 files changed

+120
-8
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
name: Build and Test (${{ matrix.dotnet-version }})
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
dotnet-version: ['8.0.x', '9.0.x']
17+
18+
env:
19+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
20+
DOTNET_NOLOGO: 1
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Setup .NET ${{ matrix.dotnet-version }}
27+
uses: actions/setup-dotnet@v4
28+
with:
29+
dotnet-version: ${{ matrix.dotnet-version }}
30+
31+
- name: Cache NuGet packages
32+
uses: actions/cache@v4
33+
with:
34+
path: ~/.nuget/packages
35+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
36+
restore-keys: |
37+
${{ runner.os }}-nuget-
38+
39+
- name: Restore dependencies
40+
run: dotnet restore
41+
42+
- name: Build
43+
run: dotnet build --configuration Release --no-restore
44+
45+
- name: Test
46+
run: dotnet test --configuration Release --no-build --verbosity normal
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
name: Publish to NuGet
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ref:
7+
description: Commit to release
8+
required: false
9+
release:
10+
types: [published]
11+
12+
jobs:
13+
publish:
14+
name: Publish Package
15+
runs-on: ubuntu-latest
16+
17+
permissions:
18+
id-token: write
19+
contents: read
20+
21+
environment: nuget
22+
23+
env:
24+
DOTNET_CLI_TELEMETRY_OPTOUT: 1
25+
DOTNET_NOLOGO: 1
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 0
32+
ref: ${{ github.event.inputs.ref }}
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: |
38+
8.0.x
39+
9.0.x
40+
41+
- name: Cache NuGet packages
42+
uses: actions/cache@v4
43+
with:
44+
path: ~/.nuget/packages
45+
key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }}
46+
restore-keys: |
47+
${{ runner.os }}-nuget-
48+
49+
- name: Restore dependencies
50+
run: dotnet restore
51+
52+
- name: Build
53+
run: dotnet build --configuration Release --no-restore
54+
55+
- name: Test
56+
run: dotnet test --configuration Release --no-build
57+
58+
- name: Pack
59+
run: dotnet pack ./App/badgie-migrator.csproj --configuration Release --no-build --output ./artifacts
60+
61+
- name: Login to NuGet (Trusted Publishing)
62+
id: nuget-login
63+
uses: nuget/login@v1
64+
with:
65+
user: sklivvz
66+
67+
- name: Push to NuGet.org
68+
run: dotnet nuget push ./artifacts/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key "${{ steps.nuget-login.outputs.NUGET_API_KEY }}"

App/badgie-migrator.csproj

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
</PropertyGroup>
2727

2828
<PropertyGroup>
29-
<VersionPrefix>1.4</VersionPrefix>
30-
<VersionPrefix Condition=" '$(BUILD_BUILDID)' != '' ">$(VersionPrefix).$(BUILD_BUILDID)</VersionPrefix>
31-
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
32-
<PackageReleaseNotes>Minor: Add verbose mode and optionally remove stack traces</PackageReleaseNotes>
29+
<Version>1.5.0</Version>
30+
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
31+
<PackageReleaseNotes>v1.5.0: Migrated CI/CD from Azure DevOps to GitHub Actions with Trusted Publishing.</PackageReleaseNotes>
32+
<PackageReadmeFile>README.md</PackageReadmeFile>
3333
</PropertyGroup>
3434
<ItemGroup>
3535
<PackageReference Include="Dapper" Version="1.60.9" />
@@ -38,9 +38,7 @@
3838
<PackageReference Include="Npgsql" Version="8.0.3" />
3939
</ItemGroup>
4040
<ItemGroup>
41-
<None Include="icon.png">
42-
<Pack>True</Pack>
43-
<PackagePath></PackagePath>
44-
</None>
41+
<None Include="icon.png" Pack="true" PackagePath="" />
42+
<None Include="../README.md" Pack="true" PackagePath="" />
4543
</ItemGroup>
4644
</Project>

0 commit comments

Comments
 (0)