-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (89 loc) · 3.45 KB
/
Copy pathci.yml
File metadata and controls
102 lines (89 loc) · 3.45 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: 'CI'
concurrency:
group: ${{ github.ref }}-ci
cancel-in-progress: true
permissions:
packages: write
on:
pull_request:
types: [ labeled, opened, synchronize, reopened ]
push:
branches: [ main ]
release:
types: [ published ]
env:
DOTNET_NOLOGO: true
NUGET_KEY: ${{ secrets.NUGET_API_KEY }}
jobs:
labels:
name: Label taking off
if: github.event.label.name == 'publish'
runs-on: ubuntu-latest
steps:
- name: Take off label
uses: actions/github-script@v8
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: >
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: '${{ github.event.label.name }}'
})
build:
name: Build, test and pack
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: true
- name: Setup .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.x
9.x
cache: true
cache-dependency-path: src/**/packages.lock.json
- name: Restore
working-directory: ./src
run: dotnet restore -v normal --locked-mode
- name: Build
working-directory: ./src
run: dotnet build -c Release --no-restore -v normal -ds -m
- name: Test
timeout-minutes: 10
working-directory: ./src
run: |
dotnet test --no-build --framework net8.0 -c Release --logger "console;verbosity=normal" --logger "trx;LogFilePrefix=results" -m
dotnet test --no-build --framework net9.0 -c Release --logger "console;verbosity=normal" --logger "trx;LogFilePrefix=results" -m
env:
RoomsPrefix: "GitHubCi_${{ github.run_id }}"
GuessWordClient__Username: ${{ vars.GUESSWORD_USERNAME }}
GuessWordClient__Password: ${{ secrets.GUESSWORD_PASSWORD }}
- name: Upload test results trx files
uses: actions/upload-artifact@v6
if: success() || failure()
with:
name: test-results
path: '**/*.trx'
- name: Pack and publish Release package
if: github.event_name == 'release'
working-directory: ./src
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]//v}"
echo Publish package version: $VERSION
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION -p:RunNumber=${{ github.run_number }}
dotnet nuget push "**/bin/Release/*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }} --skip-duplicate
dotnet nuget push "**/bin/Release/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key $NUGET_KEY --skip-duplicate
- name: Pack and publish PR package
if: github.event.label.name == 'publish'
working-directory: ./src
run: |
VERSION=${{ github.event.number }}.${{ github.run_number }}
dotnet pack -v normal -c Release --include-symbols --include-source -p:PackageVersion=$VERSION
dotnet nuget push "**/bin/Release/*.nupkg" --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --api-key ${{ github.token }} --skip-duplicate