-
Notifications
You must be signed in to change notification settings - Fork 3
82 lines (64 loc) · 2.56 KB
/
release.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
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
name: "Webhooks Release"
permissions:
contents: read
packages: write
on:
release:
types: [published]
jobs:
build:
name: "Build and Test"
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
dotnet: [ '6.0.x', '7.0.x', '8.0.x' ]
steps:
- uses: actions/checkout@v4
- name: Set VERSION variable from tag
run: |
TAG=${{ github.event.release.tag_name }}
echo "VERSION=${TAG#v}" >> $GITHUB_ENV
- name: Setup .NET ${{ matrix.dotnet }}
uses: actions/setup-dotnet@v4
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Set the TFM in Ubuntu
if: startsWith(matrix.os, 'ubuntu')
run: |
VERSION=$(echo "${{ matrix.dotnet }}" | sed 's/[^0-9.]*//g')
VERSION=$(echo "${VERSION}" | sed 's/\.$//')
DOTNET_TFM="net${VERSION}"
echo "DOTNET_TFM=$DOTNET_TFM" >> $GITHUB_ENV
- name: Set the TFM in Windows
if: startsWith(matrix.os, 'windows')
run: |
$VERSION = "${{ matrix.dotnet }}".Substring(0, "${{ matrix.dotnet }}".LastIndexOf('.'))
$DOTNET_TFM = "net$VERSION"
echo "DOTNET_TFM=$DOTNET_TFM" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore -c Release /p:Version=$VERSION -f ${{ env.DOTNET_TFM }}
- name: Test (Ubuntu)
if: startsWith(matrix.os, 'ubuntu-latest')
run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_TFM }} /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Exclude="[*.XUnit]*"
- name: Test (Windows)
if: startsWith(matrix.os, 'windows')
run: dotnet test --no-build --verbosity normal -c Release -f ${{ env.DOTNET_TFM }} --filter DB!=SQLServer
- name: Collect to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.OCM_CODECOV_TOKEN }}
pack:
needs: build
runs-on: ubuntu-latest
name: "Pack"
steps:
- uses: actions/checkout@v4
- name: Pack
run: dotnet pack --configuration Release --include-symbols -p:PackageVersion=$VERSION --output ./nuget
- name: Push Packages to GitHub NuGet
run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.GITHUB_TOKEN}} --source "https://nuget.pkg.github.com/deveel/index.json"
- name: Push Packages to NuGet
run: dotnet nuget push ./nuget/**/*.nupkg --skip-duplicate --api-key ${{secrets.NUGET_API_KEY}} --source https://api.nuget.org/v3/index.json