Skip to content

Commit

Permalink
Merge pull request #9 from mod-posh/v1.1.0
Browse files Browse the repository at this point in the history
V1.1.0
  • Loading branch information
jeffpatton1971 authored Aug 26, 2024
2 parents 0790d7f + 3d8a9fd commit 0ecc45d
Show file tree
Hide file tree
Showing 5 changed files with 166 additions and 47 deletions.
72 changes: 72 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ "main" ]
schedule:
- cron: '19 8 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'csharp' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
63 changes: 30 additions & 33 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,70 +1,67 @@
name: .NET 7 Build, Test, and Release Process
name: Build Logger Project

on:
push:
branches: [ main ]
branches:
- main
pull_request:
branches:
- main

jobs:
build_and_test:
runs-on: windows-latest
outputs:
should-run: ${{ steps.set-output.outputs.should-run }}

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'

- name: Restore dependencies
run: dotnet restore ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln
run: dotnet restore ${{ github.workspace }}/Logger/Logger.sln

- name: Clean
run: dotnet clean ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release
run: dotnet clean ${{ github.workspace }}/Logger/Logger.sln --configuration Release

- name: Build
run: dotnet build ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-restore
run: dotnet build ${{ github.workspace }}/Logger/Logger.sln --configuration Release --no-restore

- name: Test
run: dotnet test ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-build
run: dotnet test ${{ github.workspace }}/Logger/Logger.sln --configuration Release --no-build --logger "trx;LogFileName=test_results.trx"

- name: Set Output
run: echo "::set-output name=should-run::true"
id: set-output

project_operations:
needs: build_and_test
if: needs.build_and_test.outputs.should-run == 'true'
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Generate Release Notes from Milestone
uses: jeffpatton1971/[email protected]
- name: Publish Test Results
if: always()
uses: actions/upload-artifact@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
milestone: '<YourMilestone>'
name: Test Results
path: '**/TestResults/*.trx'

pack_and_publish:
needs: [build_and_test, project_operations]
if: needs.build_and_test.outputs.should-run == 'true'
needs: build_and_test
if: success()
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Setup .NET
uses: actions/setup-dotnet@v1
uses: actions/setup-dotnet@v4
with:
dotnet-version: '7.0.x'

- name: Restore dependencies
run: dotnet restore ${{ github.workspace }}/Logger/Logger.sln

- name: Build
run: dotnet build ${{ github.workspace }}/Logger/Logger.sln --configuration Release --no-restore

- name: Package
run: dotnet pack ${{ github.workspace }}/<YourProjectName>/<YourProjectName>.sln --configuration Release --no-build --output nupkgs
run: dotnet pack ${{ github.workspace }}/Logger/Logger.sln --configuration Release --output nupkgs

- name: Publish NuGet Package
run: |
nuget push **/*.nupkg -k ${{secrets.NUGET_API_KEY}} -s https://api.nuget.org/v3/index.json
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
nuget push **/*.nupkg -ApiKey ${{secrets.NUGET_API_KEY}} -Source https://api.nuget.org/v3/index.json
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
72 changes: 61 additions & 11 deletions .github/workflows/milestone-closed.yml
Original file line number Diff line number Diff line change
@@ -1,19 +1,69 @@
name: Generate Release Notes on Milestone Closure
name: New Release

on:
milestone:
types: [closed]

jobs:
generate_release_notes:
create-release:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v2

- name: Generate Release Notes
uses: jeffpatton1971/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}
milestone: ${{ github.event.milestone.number }}
- name: Checkout Repository
uses: actions/checkout@v3

- name: Get Project Version
id: get_version
uses: mod-posh/[email protected]
with:
Filename: 'Logger/Logger.csproj'
verbose: "verbose"

- name: Create Release Notes
uses: mod-posh/[email protected]
with:
milestone_number: ${{ github.event.milestone.number }}
verbose: 'verbose'
github_token: ${{ secrets.PAT }}

- name: Pull Latest Changes
run: git pull origin ${{ github.ref_name }}
shell: bash

- name: Create Release
uses: mod-posh/[email protected]
with:
name: 'Release v${{ env.VERSION }}'
filename: 'RELEASE.md'
version: ${{ env.VERSION }}
verbose: 'verbose'
github_token: ${{ secrets.PAT }}

- name: Install XMLDocMD Tool
run: dotnet tool install --global xmldocmd

- name: Build Project
run: dotnet build Logger/Logger.csproj --configuration Release

- name: Publish Project
run: dotnet publish Logger/Logger.csproj --configuration Release --output ./publish

- name: Generate Documentation
run: |
xmldocmd ./publish/Logger.dll Docs --visibility private --clean --namespace ModPosh.Logger --namespace-pages
env:
PATH: ${{ github.runner.tool_cache }}/.dotnet/tools:$PATH:~/.dotnet/tools

- name: Run markdownlint-cli2-action
uses: DavidAnson/markdownlint-cli2-action@v16
with:
globs: '**/*.md'
fix: true

- name: Commit Documentation Changes
run: |
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git add Docs/
git commit -m "Update documentation for release v${{ env.VERSION }}"
git push origin ${{ github.ref_name }}
if: success()
2 changes: 1 addition & 1 deletion Logger.Tests/Logger.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<ImplicitUsings>enable</ImplicitUsings>
<IsTestProject>true</IsTestProject>
<Nullable>enable</Nullable>
Expand Down
4 changes: 2 additions & 2 deletions Logger/Logger.csproj
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<PackageId>ModPosh.Logger</PackageId>
<TargetFramework>net7.0</TargetFramework>
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
<RootNamespace>ModPosh.Logger</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
<Version>1.0.1</Version>
<Version>1.1.0</Version>
<Authors>Jeffrey S. Patton</Authors>
<Company>Patton-Tech.com</Company>
<Description>A Logging library for .Net and PowerShell</Description>
Expand Down

0 comments on commit 0ecc45d

Please sign in to comment.