-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (35 loc) · 1.48 KB
/
ci.yaml
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
# .github/workflows/dotnet.yml
name: .NET CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '7.x' # Specify the version or use 'latest' for the most recent
- name: Install dependencies
run: cd Tool/BuildAutomationTool && dotnet restore BuildAutomationTool.sln
- name: Lint the code
run: cd Tool/BuildAutomationTool && dotnet format --verify-no-changes
continue-on-error: true
- name: Build the project
run: cd Tool/BuildAutomationTool && dotnet build BuildAutomationTool.sln --no-restore --configuration Release
- name: Run unit tests
run: cd Tool/BuildAutomationTool && dotnet test BuildAutomationTool.sln --no-build --configuration Release --verbosity normal
- name: Package the project
run: cd Tool/BuildAutomationTool && dotnet pack BuildAutomationTool.sln --no-build --configuration Release -o ./artifacts
- name: Publish package to GitHub Packages
if: github.ref == 'refs/heads/main' && success() # Publish only on successful builds of the main branch
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: cd Tool/BuildAutomationTool && dotnet nuget push ./artifacts/*.nupkg --source "https://nuget.pkg.github.com/LoveDuckie/index.json" --api-key ${{ secrets.GITHUB_TOKEN }}