Skip to content

Commit 1c0f27a

Browse files
chore: add CodeQL, Dependabot, release-please, and improve CI/CD pipeline
1 parent ff48615 commit 1c0f27a

9 files changed

Lines changed: 615 additions & 62 deletions

File tree

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.2.5"
3+
}

.github/dependabot.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 2
2+
3+
updates:
4+
# NuGet packages
5+
- package-ecosystem: nuget
6+
directory: /
7+
schedule:
8+
interval: weekly
9+
day: monday
10+
open-pull-requests-limit: 10
11+
labels:
12+
- dependencies
13+
- nuget
14+
commit-message:
15+
prefix: "deps(nuget)"
16+
groups:
17+
# Group minor/patch updates to reduce PR noise
18+
microsoft:
19+
patterns:
20+
- "Microsoft.*"
21+
update-types:
22+
- minor
23+
- patch
24+
testing:
25+
patterns:
26+
- "xunit*"
27+
- "Moq*"
28+
- "coverlet*"
29+
update-types:
30+
- minor
31+
- patch
32+
33+
# GitHub Actions
34+
- package-ecosystem: github-actions
35+
directory: /
36+
schedule:
37+
interval: weekly
38+
day: monday
39+
open-pull-requests-limit: 5
40+
labels:
41+
- dependencies
42+
- github-actions
43+
commit-message:
44+
prefix: "deps(actions)"

.github/release-please-config.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/refs/heads/main/schemas/config.json",
3+
"packages": {
4+
".": {
5+
"release-type": "simple",
6+
"package-name": "JsonApiToolkit",
7+
"changelog-sections": [
8+
{ "type": "feat", "section": "Features", "hidden": false },
9+
{ "type": "fix", "section": "Bug Fixes", "hidden": false },
10+
{ "type": "perf", "section": "Performance", "hidden": false },
11+
{ "type": "refactor", "section": "Refactoring", "hidden": false },
12+
{ "type": "docs", "section": "Documentation", "hidden": false },
13+
{ "type": "test", "section": "Tests", "hidden": true },
14+
{ "type": "chore", "section": "Maintenance", "hidden": true },
15+
{ "type": "deps", "section": "Dependencies", "hidden": false }
16+
],
17+
"extra-files": [
18+
{
19+
"type": "xml",
20+
"path": "JsonApiToolkit/JsonApiToolkit.csproj",
21+
"xpath": "//Project/PropertyGroup/Version"
22+
}
23+
]
24+
}
25+
}
26+
}

.github/release.yml

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

.github/workflows/ci-cd.yml

Lines changed: 58 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -2,55 +2,74 @@ name: CI/CD Pipeline
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [main]
6+
paths-ignore:
7+
- "docs/**"
8+
- "**.md"
9+
- ".github/ISSUE_TEMPLATE/**"
10+
- ".claude/**"
611
pull_request:
7-
branches: [ main ]
12+
branches: [main]
13+
paths-ignore:
14+
- "docs/**"
15+
- "**.md"
16+
- ".github/ISSUE_TEMPLATE/**"
17+
- ".claude/**"
818
release:
9-
types: [ published ]
19+
types: [published]
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ github.ref }}
23+
cancel-in-progress: true
1024

1125
jobs:
1226
build-and-test:
1327
runs-on: ubuntu-latest
14-
28+
1529
steps:
16-
- uses: actions/checkout@v4
17-
18-
- name: Setup .NET
19-
uses: actions/setup-dotnet@v4
20-
with:
21-
dotnet-version: 9.x.x
22-
23-
- name: Restore dependencies
24-
run: dotnet restore
25-
26-
- name: Build
27-
run: dotnet build --no-restore --configuration Release
28-
29-
- name: Test
30-
run: dotnet test --no-build --configuration Release --verbosity normal
30+
- uses: actions/checkout@v4
31+
32+
- name: Setup .NET
33+
uses: actions/setup-dotnet@v4
34+
with:
35+
dotnet-version: 9.x
36+
37+
- name: Restore dependencies
38+
run: dotnet restore
39+
40+
- name: Check formatting
41+
run: |
42+
dotnet tool restore
43+
dotnet csharpier . --check
44+
45+
- name: Build
46+
run: dotnet build --no-restore --configuration Release
47+
48+
- name: Test
49+
run: dotnet test --no-build --configuration Release --verbosity normal
3150

3251
publish:
3352
needs: build-and-test
3453
if: github.event_name == 'release'
3554
runs-on: ubuntu-latest
36-
55+
3756
steps:
38-
- uses: actions/checkout@v4
39-
40-
- name: Setup .NET
41-
uses: actions/setup-dotnet@v4
42-
with:
43-
dotnet-version: 9.x.x
44-
source-url: https://nuget.pkg.github.com/Intility/index.json
45-
env:
46-
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}
47-
48-
- name: Build and Pack
49-
run: |
50-
VERSION="${{ github.event.release.tag_name }}"
51-
# Remove v prefix if present
52-
[[ "$VERSION" =~ ^v ]] && VERSION="${VERSION:1}"
53-
dotnet pack JsonApiToolkit/JsonApiToolkit.csproj -p:PackageVersion=$VERSION -c Release
54-
55-
- name: Publish to GitHub Packages
56-
run: dotnet nuget push "JsonApiToolkit/bin/Release/*.nupkg" --api-key ${{ secrets.NUGET_AUTH_TOKEN }}
57+
- uses: actions/checkout@v4
58+
59+
- name: Setup .NET
60+
uses: actions/setup-dotnet@v4
61+
with:
62+
dotnet-version: 9.x
63+
source-url: https://nuget.pkg.github.com/Intility/index.json
64+
env:
65+
NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }}
66+
67+
- name: Build and Pack
68+
run: |
69+
VERSION="${{ github.event.release.tag_name }}"
70+
# Remove v prefix if present
71+
[[ "$VERSION" =~ ^v ]] && VERSION="${VERSION:1}"
72+
dotnet pack JsonApiToolkit/JsonApiToolkit.csproj -p:PackageVersion=$VERSION -c Release
73+
74+
- name: Publish to GitHub Packages
75+
run: dotnet nuget push "JsonApiToolkit/bin/Release/*.nupkg" --api-key ${{ secrets.NUGET_AUTH_TOKEN }}

.github/workflows/codeql.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- "**.cs"
8+
- "**.csproj"
9+
pull_request:
10+
branches: [main]
11+
paths:
12+
- "**.cs"
13+
- "**.csproj"
14+
schedule:
15+
- cron: "0 6 * * 1" # Monday 6am UTC
16+
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}
19+
cancel-in-progress: true
20+
21+
jobs:
22+
analyze:
23+
name: Analyze
24+
runs-on: ubuntu-latest
25+
permissions:
26+
security-events: write
27+
packages: read
28+
actions: read
29+
contents: read
30+
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v4
34+
35+
- name: Setup .NET
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
dotnet-version: 9.x
39+
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v3
42+
with:
43+
languages: csharp
44+
queries: security-and-quality
45+
46+
- name: Build
47+
run: dotnet build --configuration Release
48+
49+
- name: Perform CodeQL Analysis
50+
uses: github/codeql-action/analyze@v3
51+
with:
52+
category: "/language:csharp"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release Please
2+
3+
permissions:
4+
contents: write
5+
pull-requests: write
6+
7+
on:
8+
push:
9+
branches:
10+
- main
11+
12+
jobs:
13+
release-please:
14+
if: github.event_name == 'push'
15+
name: 🚀 Release Please
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
pull-requests: write
20+
steps:
21+
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf
22+
id: app-token
23+
with:
24+
app-id: ${{ vars.RELEASE_BOT_APP_ID }}
25+
private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }}
26+
27+
- uses: googleapis/release-please-action@16a9c90856f42705d54a6fda1823352bdc62cf38
28+
with:
29+
token: ${{ steps.app-token.outputs.token }}
30+
config-file: .github/release-please-config.json
31+
manifest-file: .github/release-please-manifest.json

JsonApiToolkit/JsonApiToolkit.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
<!-- Package metadata -->
99
<PackageId>Intility.JsonApiToolkit</PackageId>
10-
<Version>1.1.22-local</Version>
10+
<Version>1.2.5</Version>
1111
<Authors>Intility</Authors>
1212
<Company>Intility</Company>
1313
<Description>A toolkit for implementing JSON:API specification in .NET applications</Description>

0 commit comments

Comments
 (0)