Skip to content

Add ci workflow #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
May 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,6 @@ FodyWeavers.xsd
# Rider auto-generates .iml files, and contentModel.xml
**/.idea/**/*.iml
**/.idea/**/contentModel.xml
**/.idea/**/modules.xml
**/.idea/**/modules.xml

/.idea
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion LICENSE.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/.name

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

6 changes: 0 additions & 6 deletions src/.idea/.idea.Serilog.Sinks.Autodesk.Revit/.idea/vcs.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,7 @@
<PackagePath>\</PackagePath>
<Link>assets\README.md</Link>
</None>

<Content Include="../../.github/workflows/*.yml" Link="ci/%(FileName)$(FileExt)" />
</ItemGroup>
</Project>