Update README.md #52
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |