Skip to content

Commit 90365ee

Browse files
committed
Added workflows
1 parent e3c6acd commit 90365ee

2 files changed

Lines changed: 64 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will build a .NET project
2+
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
3+
4+
name: Build and Test
5+
6+
on:
7+
workflow_dispatch:
8+
push:
9+
branches: [ "main" ]
10+
paths: [ "src/**" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
paths: [ "src/**" ]
14+
15+
jobs:
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v4
22+
- name: Setup .NET
23+
uses: actions/setup-dotnet@v4
24+
with:
25+
dotnet-version: 9.0.x
26+
- name: Restore dependencies
27+
run: dotnet restore
28+
- name: Build
29+
run: dotnet build DbApiBuilderEntityGenerator.sln --configuration Release
30+
# - name: Test
31+
# run: dotnet test Platy.AdventureWorks.RestApi.sln --configuration Release --no-build --no-restore

.github/workflows/publish.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Publish to Nuget
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [ published ]
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
id-token: write # enable GitHub OIDC token issuance for this job
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
submodules: recursive
18+
- name: Setup dotnet
19+
uses: actions/setup-dotnet@v3
20+
with:
21+
dotnet-version: 9.0.x
22+
- name: Build
23+
run: dotnet build DbApiBuilderEntityGenerator.sln --configuration Release
24+
- name: Pack
25+
run: dotnet pack DbApiBuilderEntityGenerator.sln --configuration Release --no-build --no-restore --output .
26+
# Get a short-lived NuGet API key
27+
- name: NuGet login (OIDC → temp API key)
28+
uses: NuGet/login@v1
29+
id: login
30+
with:
31+
user: ${{ secrets.NUGET_USER }} # Recommended: use a secret like ${{ secrets.NUGET_USER }} for your nuget.org username (profile name), NOT your email address
32+
- name: Push to NuGet
33+
run: dotnet nuget push "*.nupkg" --api-key ${{steps.login.outputs.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json --skip-duplicate

0 commit comments

Comments
 (0)