diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..f93ca43 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,96 @@ +name: main + +permissions: + packages: write + contents: write + actions: read + checks: write + +on: + # on pull_request to master + pull_request: + types: [ opened, synchronize ] + branches: [ main, master ] + + # manual + workflow_dispatch: + +env: + output: bin + project: Serilog.Sinks.Autodesk.Revit + configuration: Release + default_branch: ${{ github.event.repository.default_branch }} + +jobs: + build: + runs-on: windows-latest + steps: + - uses: actions/checkout@v4 + + # Install the .NET Core workload + - name: Install .NET 8.0 + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + + # Build project: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-build + - name: Build + run: dotnet build -c ${{ env.configuration }} + + # Test project: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-test + - name: Test + run: dotnet test -c ${{ env.configuration }} --logger trx --results-directory "TestResults" + + # Upload tests results: https://github.com/dorny/test-reporter + - name: Upload tests results + uses: dorny/test-reporter@v1 + if: success() || failure() + with: + name: dotnet tests + path: ./TestResults/*.trx + reporter: dotnet-trx + + - name: Pack + run: dotnet pack -c ${{ env.configuration }} -o ${{ env.output }} + + # Fetch version: https://github.com/kzrnm/get-net-sdk-project-versions-action + - name: Fetch version + uses: kzrnm/get-net-sdk-project-versions-action@v2 + id: get-version + with: + proj-path: src/${{ env.project }}/${{ env.project }}.csproj + + # Upload the nuget package: https://github.com/marketplace/actions/upload-a-build-artifact + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: nuget + path: | + ${{ env.output }}/*.nupkg + ${{ env.output }}/*.snupkg + + # Publish the nuget package: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push + - name: Publish nuget + if: github.ref_name == env.default_branch + run: dotnet nuget push ${{ env.output }}/*.nupkg -s https://api.nuget.org/v3/index.json -k ${{ secrets.NUGET_API_KEY }} --skip-duplicate + + # Publish the nuget package: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-nuget-push + - name: Publish github + if: github.ref_name == env.default_branch + run: dotnet nuget push ${{ env.output }}/*.nupkg -s https://nuget.pkg.github.com/${{ github.REPOSITORY_OWNER }}/index.json -k ${{ github.TOKEN }} --skip-duplicate + + # Publish release: https://github.com/softprops/action-gh-release + - name: Publish Release + if: github.ref_name == env.default_branch + uses: softprops/action-gh-release@v1 + env: + GITHUB_TOKEN: ${{ github.TOKEN }} + with: + tag_name: v${{ steps.get-version.outputs.package-version }} + name: v${{ steps.get-version.outputs.package-version }} + body: v${{ steps.get-version.outputs.package-version }} + draft: true + prerelease: false + files: | + ${{ env.output }}/*.nupkg + ${{ env.output }}/*.snupkg \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7094a04..cd01e5f 100644 --- a/.gitignore +++ b/.gitignore @@ -395,4 +395,6 @@ FodyWeavers.xsd # Rider auto-generates .iml files, and contentModel.xml **/.idea/**/*.iml **/.idea/**/contentModel.xml -**/.idea/**/modules.xml \ No newline at end of file +**/.idea/**/modules.xml + +/.idea \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a7c4f01 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,13 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [v2.0.0] - 2024-05-14 +### Add + +- net8.0 target framework +- ci workflow +- CHANGELOG.md \ No newline at end of file diff --git a/LICENSE.md b/LICENSE.md index 0a9bf81..be3736b 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023 Biseuv Olzhas (dosymep) +Copyright (c) 2024 Biseuv Olzhas (dosymep) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 38f0d7a..a39ecec 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,10 @@ # Serilog.Sinks.Autodesk.Revit +[![JetBrains Rider](https://img.shields.io/badge/JetBrains-Rider-blue.svg)](https://www.jetbrains.com/rider) +[![License MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE.md) +[![Revit 2017-2025](https://img.shields.io/badge/Revit-2017--2025-blue.svg)](https://www.autodesk.com/products/revit/overview) +[![main](https://github.com/dosymep/Serilog.Sinks.Autodesk.Revit/actions/workflows/main.yml/badge.svg)](https://github.com/dosymep/Serilog.Sinks.Autodesk.Revit/actions/workflows/main.yml) + Writes [Serilog](https://serilog.net) events to Autodesk Revit [Journal](https://www.revitapidocs.com/2022/97ec1eca-ab92-1cee-fdda-7bf3ce91c504.htm). ### Getting started @@ -17,7 +22,7 @@ To configure the sink in C# code, call `WriteTo.RevitJournal()` during logger co public Result Execute(ExternalCommandData commandData, out string message, ElementSet elements) { - UIApplication uiApplication = commandData.Application; + UIApplic[.gitignore](.gitignore)ation uiApplication = commandData.Application; var log = new LoggerConfiguration() .WriteTo.RevitJournal(uiApplication) .CreateLogger(); diff --git a/src/Serilog.Sinks.Autodesk.Revit.sln b/Serilog.Sinks.Autodesk.Revit.sln similarity index 73% rename from src/Serilog.Sinks.Autodesk.Revit.sln rename to Serilog.Sinks.Autodesk.Revit.sln index 963f6b1..b56ce40 100644 --- a/src/Serilog.Sinks.Autodesk.Revit.sln +++ b/Serilog.Sinks.Autodesk.Revit.sln @@ -1,17 +1,18 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Autodesk.Revit", "Serilog.Sinks.Autodesk.Revit\Serilog.Sinks.Autodesk.Revit.csproj", "{B7745F16-A858-493D-A548-E02DAEA0359B}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Autodesk.Revit", "src/Serilog.Sinks.Autodesk.Revit\Serilog.Sinks.Autodesk.Revit.csproj", "{B7745F16-A858-493D-A548-E02DAEA0359B}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{295B355A-0CB2-4965-8603-765D04882D69}" ProjectSection(SolutionItems) = preProject - ..\.editorconfig = ..\.editorconfig - ..\CONTRIBUTING.md = ..\CONTRIBUTING.md - ..\CREDITS.md = ..\CREDITS.md - ..\LICENSE.md = ..\LICENSE.md - ..\README.md = ..\README.md + .editorconfig = .editorconfig + CONTRIBUTING.md = CONTRIBUTING.md + CREDITS.md = CREDITS.md + LICENSE.md = LICENSE.md + README.md = README.md + CHANGELOG.md = CHANGELOG.md EndProjectSection EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Autodesk.Revit.Tests", "Serilog.Sinks.Autodesk.Revit.Tests\Serilog.Sinks.Autodesk.Revit.Tests.csproj", "{508A5950-2DBA-475D-A083-8E5161D5E5B9}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Serilog.Sinks.Autodesk.Revit.Tests", "src/Serilog.Sinks.Autodesk.Revit.Tests\Serilog.Sinks.Autodesk.Revit.Tests.csproj", "{508A5950-2DBA-475D-A083-8E5161D5E5B9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/.name b/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/.name deleted file mode 100644 index a55e81e..0000000 --- a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Serilog.Sinks.Autodesk.Revit \ No newline at end of file diff --git a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/encodings.xml b/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/encodings.xml deleted file mode 100644 index df87cf9..0000000 --- a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/encodings.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/indexLayout.xml b/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/indexLayout.xml deleted file mode 100644 index 7b08163..0000000 --- a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/indexLayout.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/projectSettingsUpdater.xml b/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/projectSettingsUpdater.xml deleted file mode 100644 index 4bb9f4d..0000000 --- a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/projectSettingsUpdater.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/vcs.xml b/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/vcs.xml deleted file mode 100644 index 6c0b863..0000000 --- a/src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/Serilog.Sinks.Autodesk.Revit/Serilog.Sinks.Autodesk.Revit.csproj b/src/Serilog.Sinks.Autodesk.Revit/Serilog.Sinks.Autodesk.Revit.csproj index 8c8025c..c0792d1 100644 --- a/src/Serilog.Sinks.Autodesk.Revit/Serilog.Sinks.Autodesk.Revit.csproj +++ b/src/Serilog.Sinks.Autodesk.Revit/Serilog.Sinks.Autodesk.Revit.csproj @@ -71,5 +71,7 @@ \ assets\README.md + +