-
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (135 loc) · 3.94 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
# Builds and runs tests in all three supported OSes
# Pushes CI feed if secrets.SLEET_CONNECTION is provided
name: build
on:
workflow_dispatch:
push:
branches: [ main, dev, 'dev/*', 'feature/*', 'rel/*' ]
paths-ignore:
- changelog.md
- code-of-conduct.md
- security.md
- support.md
- readme.md
pull_request:
types: [opened, synchronize, reopened]
release:
types: [released]
env:
DOTNET_NOLOGO: true
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
defaults:
run:
shell: bash
jobs:
version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.release.outputs.version }}
label: ${{ steps.dev.outputs.label }}
steps:
- name: release
id: release
if: github.event_name == 'release'
run: |
echo "version=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT
- name: dev
id: dev
if: github.event_name != 'release'
run: |
echo "label=$GITHUB_REF.$GITHUB_RUN_NUMBER" >> $GITHUB_OUTPUT
build:
name: build-${{ matrix.os }}
needs: version
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'macOS-latest', 'ubuntu-latest', 'windows-latest' ]
env:
Version: ${{ needs.version.outputs.version }}
VersionLabel: ${{ needs.version.outputs.label }}
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: 🙏 build
run: dotnet build
- name: 📦 pack
run: dotnet pack
- name: ⬆️ upload
# Only upload package from windows (can't run ILRepack on linux/macOS)
if: success() && matrix.os == 'windows-latest'
uses: actions/upload-artifact@v3
with:
name: pkg
path: bin/*
test:
needs: [version, build]
name: test-${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ 'macOS-latest', 'ubuntu-latest', 'windows-latest' ]
env:
Version: ${{ needs.version.outputs.version }}
VersionLabel: ${{ needs.version.outputs.label }}
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: ⬇️ artifacts
uses: actions/download-artifact@v3
with:
name: pkg
path: bin
- name: 🧪 test
run: dotnet test --nologo -bl --logger:"console;verbosity=normal"
- name: 🐛 logs
uses: actions/upload-artifact@v3
if: runner.debug && always()
with:
name: test-${{ matrix.os }}
path: '*.binlog'
push:
needs: test
if: success()
runs-on: ubuntu-latest
steps:
- name: ⬇️ artifacts
uses: actions/download-artifact@v3
with:
name: pkg
path: bin
- name: 🚀 sleet
env:
SLEET_CONNECTION: ${{ secrets.SLEET_CONNECTION }}
if: env.SLEET_CONNECTION != ''
run: |
dotnet tool install -g --version 4.0.18 sleet
sleet push ./bin/**/*.nupkg --config none -f --verbose -p "SLEET_FEED_CONTAINER=nuget" -p "SLEET_FEED_CONNECTIONSTRING=${{ secrets.SLEET_CONNECTION }}" -p "SLEET_FEED_TYPE=azure" || echo "No packages found"
publish:
needs: test
if: github.event_name == 'release'
runs-on: ubuntu-latest
steps:
- name: ⬇️ artifacts
uses: actions/download-artifact@v3
with:
name: pkg
path: bin
- name: 🚀 nuget
run: dotnet nuget push ./bin/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} --skip-duplicate
dotnet-format:
runs-on: ubuntu-latest
steps:
- name: 🤘 checkout
uses: actions/checkout@v2
with:
submodules: recursive
fetch-depth: 0
- name: ✓ ensure format
run: dotnet format --verify-no-changes -v:diag --exclude ~/.nuget