refactor(desktop): интеграция новых сервисов в MainWindow и ViewModels #96
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
| name: Release | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| env: | |
| DOTNET_VERSION: '8.0.x' | |
| NODE_VERSION: '20' | |
| REGISTRY: ghcr.io | |
| permissions: | |
| contents: write | |
| packages: write | |
| issues: write | |
| pull-requests: write | |
| jobs: | |
| # =========================================== | |
| # Run Tests First | |
| # =========================================== | |
| test: | |
| name: Run Tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Test API | |
| run: dotnet test HQStudio.API.Tests/HQStudio.API.Tests.csproj --verbosity normal | |
| - name: Test Web | |
| working-directory: HQStudio.Web | |
| run: | | |
| npm ci --legacy-peer-deps | |
| npm test | |
| # =========================================== | |
| # Semantic Release | |
| # =========================================== | |
| release: | |
| name: Semantic Release | |
| runs-on: ubuntu-latest | |
| needs: test | |
| outputs: | |
| new_release_published: ${{ steps.semantic.outputs.new_release_published }} | |
| new_release_version: ${{ steps.semantic.outputs.new_release_version }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Semantic Release | |
| id: semantic | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: npx semantic-release || echo "No release needed" | |
| # =========================================== | |
| # Build & Push Docker Images | |
| # =========================================== | |
| docker: | |
| name: Build Docker Images | |
| runs-on: ubuntu-latest | |
| needs: release | |
| if: needs.release.outputs.new_release_published == 'true' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Log in to Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push API | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./HQStudio.API | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ github.repository }}/api:${{ needs.release.outputs.new_release_version }} | |
| ${{ env.REGISTRY }}/${{ github.repository }}/api:latest | |
| - name: Build and push Web | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: ./HQStudio.Web | |
| push: true | |
| tags: | | |
| ${{ env.REGISTRY }}/${{ github.repository }}/web:${{ needs.release.outputs.new_release_version }} | |
| ${{ env.REGISTRY }}/${{ github.repository }}/web:latest | |
| # =========================================== | |
| # Build Desktop Release | |
| # =========================================== | |
| desktop: | |
| name: Build Desktop | |
| runs-on: windows-latest | |
| needs: release | |
| if: needs.release.outputs.new_release_published == 'true' | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v5 | |
| with: | |
| dotnet-version: ${{ env.DOTNET_VERSION }} | |
| - name: Update version in csproj | |
| run: | | |
| $version = "${{ needs.release.outputs.new_release_version }}" | |
| $csproj = "HQStudio.Desktop/HQStudio.csproj" | |
| $content = Get-Content $csproj -Raw | |
| $content = $content -replace '<Version>.*</Version>', "<Version>$version</Version>" | |
| Set-Content $csproj $content | |
| Write-Host "Updated version to $version" | |
| - name: Publish Desktop | |
| run: dotnet publish HQStudio.Desktop/HQStudio.csproj -c Release -r win-x64 --self-contained -p:PublishSingleFile=true -p:Version=${{ needs.release.outputs.new_release_version }} -o ./publish | |
| - name: Create ZIP | |
| run: Compress-Archive -Path ./publish/* -DestinationPath HQStudio-Desktop-v${{ needs.release.outputs.new_release_version }}.zip | |
| - name: Upload to Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: v${{ needs.release.outputs.new_release_version }} | |
| files: HQStudio-Desktop-v${{ needs.release.outputs.new_release_version }}.zip |