-
Notifications
You must be signed in to change notification settings - Fork 7
49 lines (40 loc) · 1.42 KB
/
actions.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: .NET SDK CI/CD
on:
workflow_dispatch:
env:
PROJECT_PATH: 'src/com.telstra.messaging/com.telstra.messaging.csproj'
PACKAGE_OUTPUT_DIRECTORY: ${{ github.workspace }}/output
NUGET_SOURCE_URL: 'https://api.nuget.org/v3/index.json'
jobs:
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: "7.0.x" # Change to your desired .NET version
- name: Restore Dependencies
run: dotnet restore ${{ env.PROJECT_PATH }}
- name: Build
run: dotnet build ${{ env.PROJECT_PATH }} --no-restore --configuration Release
publish:
name: Publish to NuGet
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up .NET Core
uses: actions/setup-dotnet@v2
with:
dotnet-version: "7.0.x" # Change to your desired .NET version
- name: Publish to NuGet
run: |
nuget restore
dotnet msbuild ${{ env.PROJECT_PATH }} /p:OutputPath=${{ env.PACKAGE_OUTPUT_DIRECTORY }}
dotnet nuget push ${{ env.PACKAGE_OUTPUT_DIRECTORY }}/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}