Skip to content

fix(sdk): Refactored logic and consolidated connected status control #53

fix(sdk): Refactored logic and consolidated connected status control

fix(sdk): Refactored logic and consolidated connected status control #53

Workflow file for this run

name: .NET
on:
push:
branches: [ "main" ]
paths:
- 'Kepware.Api/**'
- 'Kepware.Api.Sample/**'
- 'KepwareSync.Service/**'
- '.github/workflows/dotnet.yml'
- '!**/*.md' # Exclude markdown files
pull_request:
branches: [ "main" ]
paths:
- 'Kepware.Api/**'
- 'Kepware.Api.Sample/**'
- 'KepwareSync.Service/**'
- '.github/workflows/dotnet.yml'
- '!*.md' # Exclude markdown files
jobs:
build:
strategy:
matrix:
platform: [windows, ubuntu]
runs-on: ${{ matrix.platform }}-latest
permissions:
contents: write
pull-requests: write
packages: write
actions: read
checks: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
- uses: dotnet/nbgv@master
id: nbgv
with:
setAllVars: true
- name: Use Release Drafter
if: ${{ github.event_name != 'pull_request' && matrix.platform == 'ubuntu' }}
id: drafter
uses: release-drafter/release-drafter@v6
with:
version: ${{ steps.nbgv.outputs.SemVer2 }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 9.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration release
- name: Test
run: dotnet test --no-build --verbosity normal --configuration release --logger "trx;LogFileName=${{ matrix.platform }}-test-results.trx"
- name: Publish Test Report (${{ matrix.platform }})
if: ${{ github.event_name == 'pull_request' }}
uses: dorny/test-reporter@v1
with:
name: .NET 9 Test Report (${{ matrix.platform }})
path: "**/TestResults/**/*.trx"
reporter: dotnet-trx
- name: dotnet publish
run: dotnet publish KepwareSync.Service/Kepware.SyncService.csproj --configuration release -o publish /p:UseAppHost=true
- name: Push to GitHub Packages
if: ${{ github.event_name != 'pull_request' && matrix.platform == 'ubuntu' }}
run: |
dotnet nuget push ./Kepware.Api/bin/Release/*.nupkg \
--api-key ${{ secrets.GITHUB_TOKEN }} \
--skip-duplicate \
--source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
- name: Create and Upload Release Asset (Linux)
if: ${{ github.event_name != 'pull_request' && matrix.platform == 'ubuntu' }}
run: |
# Create the ZIP file with only the required files
zip -j Kepware.SyncService-linux-x64.zip \
$(find . -path '**/publish/Kepware.SyncService') \
$(find . -path '**/publish/Kepware.SyncService.dbg') \
$(find . -path '**/publish/appsettings.json')
# Upload the ZIP file
gh release upload v${{ steps.nbgv.outputs.SemVer2 }} Kepware.SyncService-linux-x64.zip --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create and Upload Release Asset (Windows)
if: ${{ github.event_name != 'pull_request' && matrix.platform == 'windows' }}
run: |
# Create the ZIP file with only the required files
Compress-Archive -Path @(".\publish\Kepware.SyncService.exe",".\publish\Kepware.SyncService.pdb", ".\publish\appsettings.json") -DestinationPath Kepware.SyncService-win-x64.zip
# Upload the ZIP file
gh release upload v${{ steps.nbgv.outputs.SemVer2 }} Kepware.SyncService-win-x64.zip --clobber
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}