-
Notifications
You must be signed in to change notification settings - Fork 1
84 lines (73 loc) · 2.21 KB
/
pr-build.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
name: PR Build
on:
pull_request:
branches: [main]
paths-ignore:
- "**.md"
- "LICENSE"
issue_comment:
types: [created]
jobs:
isCodeOwner:
if: github.event.issue.pull_request && contains(github.event.comment.body, '/test-pack')
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Check if comment author is a code owner
id: check
run: |
CODEOWNERS=$(cat .github/CODEOWNERS)
COMMENT_AUTHOR=${{ github.event.comment.user.login }}
if echo "$CODEOWNERS" | grep -q "$COMMENT_AUTHOR"; then
echo "::set-output name=isCodeOwner::true"
else
echo "::set-output name=isCodeOwner::false"
fi
build-release:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: dotnet build
run: dotnet build -c release
- name: dotnet publish
if: steps.isCodeOwner.outputs.isCodeOwner == 'true'
run: dotnet publish -o pub -c release -p:PublishSingleFile=true -p:Version=${{ env.APP_VERSION }}
- name: Upload binaries
if: steps.isCodeOwner.outputs.isCodeOwner == 'true'
uses: actions/upload-artifact@v4
with:
name: binaries
path: pub/FileSorter.*
choco-pack:
needs: build-release
if: steps.isCodeOwner.outputs.isCodeOwner == 'true'
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: binaries
path: bin
- name: Package
run: cd choco && choco pack --version ${{ env.APP_VERSION }}
- name: Upload nupkg
uses: actions/upload-artifact@v4
with:
name: nupkg
path: choco/*.nupkg
build-debug:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.x
- name: dotnet build
run: dotnet build -c debug