-
Notifications
You must be signed in to change notification settings - Fork 5
70 lines (56 loc) · 2.66 KB
/
publish-nuget.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
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
name: Maui CI
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
BUILD_CONFIG: 'Release'
SOLUTION: 'src/WalletFramework.sln'
IS_PULL_REQUEST: ${{ github.event_name == 'pull_request' }}
IS_MAIN_BRANCH: ${{ github.ref == 'refs/heads/main' }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set Version
run: |
sudo apt-get update && sudo apt-get install -y libxml2-utils
VERSION=$(xmllint --xpath "string(/Project/PropertyGroup/Version)" Directory.Build.props)
if $IS_MAIN_BRANCH; then
COMMIT_COUNT=$(git log --oneline | wc -l)
SUFFIX="-rc.$COMMIT_COUNT"
elif $IS_PULL_REQUEST; then
COMMIT_COUNT=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/commits?per_page=100" | jq length)
SUFFIX="-pr.${{ github.event.pull_request.number }}.$COMMIT_COUNT"
fi
echo "APP_VERSION=$VERSION$SUFFIX" >> $GITHUB_ENV
- name: Setup NuGet
uses: NuGet/[email protected]
- name: Restore dependencies
run: nuget restore $SOLUTION
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 3.1.*
# - name: Install libindy library
# run: |
# sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CE7709D068DB5E88
# sudo add-apt-repository "deb https://repo.sovrin.org/sdk/deb bionic stable"
# sudo apt-get update \
# apt-get install -y libindy
- name: Build
run: dotnet build $SOLUTION --configuration $BUILD_CONFIG -p:Version=$APP_VERSION --no-restore
- name: Run tests
run: |
dotnet test test/WalletFramework.Oid4Vc.Tests --configuration $BUILD_CONFIG --no-restore --no-build
dotnet test test/WalletFramework.SdJwtVc.Tests --configuration $BUILD_CONFIG --no-restore --no-build
- name: Pack WalletFramework
run: dotnet pack $SOLUTION --configuration $BUILD_CONFIG -p:Version=$APP_VERSION --no-build --output .
- name: Publish
run: nuget push **\*.nupkg -Source 'https://api.nuget.org/v3/index.json' -ApiKey ${{secrets.NUGET_API_KEY}}