Merge pull request #208 from ModerRAS/feat/claude-code-api-change #483
This file contains hidden or 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: Push To ClickOnce | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| jobs: | |
| BuildClickOnce: | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 10.0.x | |
| - name: Add msbuild to PATH | |
| uses: microsoft/setup-msbuild@v1.1 | |
| - name: Clear NuGet cache | |
| run: dotnet nuget locals all --clear | |
| - name: Restore dependencies | |
| run: dotnet restore --force --no-cache /p:BuildWithNetFrameworkHostedCompiler=true | |
| - name: Build | |
| run: | | |
| dotnet build --no-restore | |
| - name: Test | |
| run: dotnet test --no-build --verbosity normal | |
| - name: Publish ClickOnce | |
| shell: pwsh | |
| env: | |
| BUILD_NUMBER: ${{github.run_number}} | |
| run: | | |
| $content = 'TelegramSearchBot/Properties/PublishProfiles/ClickOnceProfile.pubxml' | |
| $xmldata = [xml](Get-Content $content) | |
| $Version = Get-Date -Format "yyyy.MM.dd.$env:BUILD_NUMBER" | |
| $env:BUILD_VERSION = Get-Date -Format "yyyy.MM.dd.$env:BUILD_NUMBER" | |
| $node = $xmldata.Project.PropertyGroup | |
| $node.ApplicationVersion = $Version | |
| $node.MinimumRequiredVersion = $Version | |
| $xmldata.Save($content) | |
| echo $env:BUILD_VERSION | |
| msbuild TelegramSearchBot /restore /t:DoPublish /p:Configuration=Release /p:PublishProfile=ClickOnceProfile /p:RuntimeIdentifier=win-x64 /p:SelfContained=true | |
| $tfm = ([xml](Get-Content "TelegramSearchBot/TelegramSearchBot.csproj")).Project.PropertyGroup.TargetFramework | Where-Object { $_ } | Select-Object -First 1 | |
| Copy-Item "TelegramSearchBot/bin/Release/$tfm/win-x64/app.publish/Publish.html" "TelegramSearchBot/bin/TelegramSearchBot/" | |
| - name: Upload to ClickOnce Server | |
| shell: pwsh | |
| env: | |
| SOURCE_DIR: 'TelegramSearchBot/bin/TelegramSearchBot' | |
| 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 account authorize $env:B2_APPKEY_ID $env:B2_APPKEY --quiet | |
| b2 sync --delete $env:SOURCE_DIR b2://$env:B2_BUCKET/TelegramSearchBot --quiet | |
| # 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 |