-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (94 loc) · 3.4 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
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
# This workflow will build a .NET project
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net
name: .NET
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore
- name: Test
run: dotnet test --no-build --verbosity normal
- name: Publish
run: dotnet publish ./SelectAndSearch/SelectAndSearch.csproj -c Release -o SelectAndSearch\bin\Release\net7.0-windows\win-x64\publish --self-contained true
- name: Upload Build Artifact
uses: actions/upload-artifact@v2
with:
name: SelectAndSearch_Release
path: SelectAndSearch\bin\Release\net7.0-windows\win-x64\publish
benchmark:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore
- name: Benchmark Release
run: dotnet run --project .\SelectAndSearch.Benchmark\SelectAndSearch.Benchmark.csproj -c Release
BuildClickOnce:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
- name: Restore dependencies
run: dotnet restore
- name: Publish ClickOnce
shell: pwsh
env:
BUILD_NUMBER: ${{github.run_number}}
run: |
$content = 'SelectAndSearch/Properties/PublishProfiles/ClickOnceProfile.pubxml'
$xmldata = [xml](Get-Content $content)
$Version = Get-Date -Format "yyyy.MM.dd.*"
$env:BUILD_VERSION = Get-Date -Format "yyyy.MM.dd.$env:BUILD_NUMBER"
$node = $xmldata.Project.PropertyGroup
$node.ApplicationVersion = $Version
$node.ApplicationRevision = $env:BuildNumber
$xmldata.Save($content)
echo $env:BUILD_VERSION
msbuild SelectAndSearch /t:DoPublish /p:Configuration=Release /p:PublishProfile=ClickOnceProfile
Copy-Item "SelectAndSearch/bin/Release/net6.0-windows/win-x64/app.publish/Publish.html" "SelectAndSearch/bin/SelectAndSearch/"
- name: Upload to ClickOnce Server
shell: pwsh
env:
SOURCE_DIR: 'SelectAndSearch/bin/SelectAndSearch'
B2_BUCKET: ${{ secrets.B2_BUCKET }}
B2_APPKEY_ID: ${{ secrets.B2_APPKEY_ID }}
B2_APPKEY: ${{ secrets.B2_APPKEY }}
run: |
pip install --quiet --no-cache-dir b2
b2 authorize-account $env:B2_APPKEY_ID $env:B2_APPKEY
b2 sync --delete --replaceNewer $env:SOURCE_DIR $env:B2_BUCKET/SelectAndSearch
# TO-DO: Delete old versions of updated files because that's what
# we're already using GitHub for... but B2 doesn't make this easy:
# https://github.com/Backblaze/B2_Command_Line_Tool/issues/324
b2 clear-account