-
Notifications
You must be signed in to change notification settings - Fork 78
71 lines (64 loc) · 2.05 KB
/
dotnet.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
name: Build and Test
on:
push:
pull_request:
workflow_dispatch:
inputs:
release:
description: 'Release NuGet package'
required: true
default: false
type: boolean
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
dotnet: [6.0.401]
node: ['14']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: Setup node
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node }}
- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ matrix.dotnet }}
- name: Install local tools
run: dotnet tool restore
- name: Paket Restore
run: dotnet paket restore
- name: Build and Test
run: dotnet fake run build.fsx
- name: Check secrets presence
id: checksecrets
shell: bash
run: |
echo "secretspresent=YES" >> $GITHUB_OUTPUT
if [ "$GITHUB_TOKEN" == "" ]; then
echo "secretspresent=NO" >> $GITHUB_OUTPUT
fi
if [ "$NUGET_KEY" == "" ]; then
echo "secretspresent=NO" >> $GITHUB_OUTPUT
fi
env:
NUGET_KEY: ${{ secrets.NUGETKEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish prerelease NuGet to GitHub
if: (steps.checksecrets.outputs.secretspresent != 'NO') && matrix.os == 'windows-latest' && github.ref == 'refs/heads/master' && github.event.inputs.release != 'true'
run: dotnet fake run build.fsx -t PublishCINuGet
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Publish NuGet to NuGet.org
if: (steps.checksecrets.outputs.secretspresent != 'NO') && matrix.os == 'windows-latest' && github.ref == 'refs/heads/master' && github.event.inputs.release == 'true'
run: dotnet fake run build.fsx -t Release
env:
NUGET_KEY: ${{ secrets.NUGETKEY }}