-
Notifications
You must be signed in to change notification settings - Fork 54
121 lines (106 loc) · 3.71 KB
/
build.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
name: Build
on:
push:
branches:
- '**'
pull_request:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
actions: read
checks: write
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.101'
- name: NuGet cache
uses: actions/cache@v1
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashFiles('.config/dotnet-tools.json') }}-${{ hashFiles('*.lock') }}
restore-keys: |
${{ runner.os }}-nuget-
- name: Build
run: |
# GH Actions puts us in detached head, but for nbgv, we need to be on the branch
if echo "${{github.ref}}" | grep -q "^refs/heads/"; then
git checkout "$(echo ${{github.ref}} | sed -E 's|^refs/heads/||')";
fi
# .NET 8 RC2 has a bug where it restores the wrong version of tools...
dotnet tool update paket --version 8.0.0
dotnet tool update nbgv --version 3.6.133
# Ensure that the selenium chrome driver matches the installed chrome
./build.ps1 -t update-chromedriver
# Build
DOTNET_RUNTIME_IDENTIFIER=linux-x64 ./build.ps1 -t all
- name: Upload nupkg
uses: actions/upload-artifact@v1
with:
name: nuget
path: build
- name: Upload test results
if: always()
uses: actions/upload-artifact@v2
with:
name: TestResults
path: tests/Unit/TestResults/*.trx
- name: Report tests
if: ${{ ! (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository) }}
uses: dorny/test-reporter@v1
with:
name: Unit tests
path: tests/Unit/TestResults/*.trx
reporter: dotnet-trx
prerelease:
runs-on: ubuntu-latest
needs: build
if: ${{ github.ref == 'refs/heads/master' || contains(github.ref, 'releases') }}
steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.101'
- name: Download nupkg
uses: actions/download-artifact@v1
with:
name: nuget
- name: Push to GitHub feed
run: dotnet nuget push nuget/*.nupkg
--api-key "${{secrets.GITHUB_TOKEN}}"
--source "https://nuget.pkg.github.com/${{github.repository_owner}}/"
--skip-duplicate
release:
runs-on: ubuntu-latest
needs: build
if: ${{ contains(github.ref, 'releases') }}
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Setup dotnet
uses: actions/setup-dotnet@v1
with:
dotnet-version: '8.0.101'
- name: Prepare
run: |
# GH Actions puts us in detached head, but for nbgv, we need to be on the branch
git checkout "$(echo ${{github.ref}} | sed -E 's|^refs/[^/]+/||')"
dotnet tool restore
SHORT_VERSION="$(dotnet nbgv get-version -v MajorMinorVersion)"
echo "SHORT_VERSION=$SHORT_VERSION" >> $GITHUB_ENV
echo "FULL_VERSION=$(dotnet nbgv get-version -v SemVer2)" >> $GITHUB_ENV
# Parse the relevant changelog entry out of CHANGELOG.md
sed -n "/^## ${SHORT_VERSION//./\\.}\$/{n;bl};d;:l;/^#/Q;p;n;bl" CHANGELOG.md > release.md
- name: Create draft release
uses: actions/create-release@v1
with:
tag_name: v${{ env.FULL_VERSION }}
release_name: Version ${{ env.SHORT_VERSION }}
body_path: release.md
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}