Skip to content

Commit

Permalink
Initial version
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalberger committed Dec 8, 2023
1 parent 42552fc commit 234534e
Show file tree
Hide file tree
Showing 29 changed files with 755 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": 1,
"isRoot": true,
"tools": {
"cake.tool": {
"version": "1.3.0",
"commands": [
"dotnet-cake"
]
}
}
}
3 changes: 3 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These owners will be the default owners for everything in the repo and
# will be requested for review when someone opens a pull request.
* @swissgrc/development
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>cake-contrib/renovate-presets:cake-recipe"
]
}
68 changes: 68 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Build

on:
push:
branches:
- main
- develop
- "feature/**"
- "release/**"
- "hotfix/**"
tags:
- "*"
paths-ignore:
- "README.md"
pull_request:

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ windows-2022, ubuntu-22.04, macos-12 ]

env:
GITHUB_PAT: ${{ secrets.GH_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
NUGET_SOURCE: "https://api.nuget.org/v3/index.json"

steps:
- name: Checkout the repository
uses: actions/[email protected]
- name: Fetch all tags and branches
run: git fetch --prune --unshallow
- uses: actions/[email protected]
with:
# codecov needs 2.1, unittests needs 3.1, gitversion needs 5.0
dotnet-version: |
2.1
5.0
6.0
7.0
8.0
- name: Cache Tools
uses: actions/[email protected]
with:
path: tools
key: ${{ runner.os }}-tools-${{ hashFiles('recipe.cake') }}
- name: Build project
uses: cake-build/[email protected]
with:
script-path: recipe.cake
target: CI
cake-version: 1.3.0
- name: Upload Issues
uses: actions/[email protected]
with:
if-no-files-found: warn
name: ${{ matrix.os }} Issues
path: |
BuildArtifacts/report.html
BuildArtifacts/**/coverlet/*.xml
- name: Upload Packages
uses: actions/[email protected]
if: runner.os == 'Windows'
with:
if-no-files-found: warn
name: package
path: BuildArtifacts/Packages/**/*
8 changes: 6 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,8 @@ __pycache__/
*.pyc

# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
tools/**
!tools/packages.config

# Tabs Studio
*.tss
Expand Down Expand Up @@ -396,3 +396,7 @@ FodyWeavers.xsd

# JetBrains Rider
*.sln.iml

# Project specific

BuildArtifacts/
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"dotnet.defaultSolution": "src\\Statiq.Alerts.sln"
}
61 changes: 60 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,61 @@
# Statiq.Alerts
📙 Extension for Statiq site generator to add annotations

<!-- markdownlint-disable MD013 -->
[![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/swissgrc/Statiq.Alerts/blob/main/LICENSE) [![Build](https://img.shields.io/github/actions/workflow/status/swissgrc/Statiq.Alerts/build.yml?branch=develop&style=flat-square)](https://github.com/swissgrc/Statiq.Alerts/actions/workflows/build.yml) [![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=swissgrc_Statiq.Alerts&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=swissgrc_Statiq.Alerts) [![Downloads](https://img.shields.io/nuget/dt/Statiq.Alerts?style=flat-square)](https://www.nuget.org/packages/Statiq.Alerts)
<!-- markdownlint-restore -->

Extension for [Statiq site generator] to add alerts.

## Requirements

The extensions require that [Bootstrap] and [FontAwesome] are loaded.

## Using

1. Add the `Statiq.Alerts` NuGet package to the Statiq project
2. Call `.AddAlertShortCodes()` on the bootstrapper

## Available Shortcodes

### Tip

### Info

### Note

### Warning

### Important

## Custom Shortcuts

Additional custom shortcuts can be implemented by inheriting from the `AlertShortcode` class and
define the `DefaultAlertClass`, `DefaultAlertIcon` and `DefaultAlertTitle` properties.
See [Parameters](#Parameters) for documentation about possible values.

## Parameters

The following parameters are available on all shortcuts and allow to override the default styling.

### Class

Allows to override the CSS class of the alert `div` element.
The `alert` class will always be set.

### Icon

Allows to override the icon of the alert.
Any [Fontawesome] icon can be used.
The `fa-solid` class will always be set.

Can be an empty string to hide the icon.

### Title

Allow to override the title of the alert.

Can be an empty string to not show any title.

[Statiq site generator]: https://www.statiq.dev/
[Bootstrap]: https://getbootstrap.com/
[FontAwesome]: https://fontawesome.com/
13 changes: 13 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
$SCRIPT_NAME = "recipe.cake"

Write-Host "Restoring .NET Core tools"
dotnet tool restore
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

Write-Host "Bootstrapping Cake"
dotnet cake $SCRIPT_NAME --bootstrap
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }

Write-Host "Running Build"
dotnet cake $SCRIPT_NAME @args
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
11 changes: 11 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash
SCRIPT_NAME="recipe.cake"

echo "Restoring .NET Core tools"
dotnet tool restore

echo "Bootstrapping Cake"
dotnet cake $SCRIPT_NAME --bootstrap

echo "Running Build"
dotnet cake $SCRIPT_NAME "$@"
7 changes: 7 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"sdk": {
"allowPrerelease": true,
"version": "8.0.100",
"rollForward": "latestFeature"
}
}
22 changes: 22 additions & 0 deletions recipe.cake
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#load nuget:?package=Cake.Recipe&version=3.1.1

Environment.SetVariableNames();

BuildParameters.SetParameters(
context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Statiq.Alerts",
masterBranchName: "main",
repositoryOwner: "swissgrc",
repositoryName: "Statiq.Alerts",
shouldRunDotNetCorePack: true,
shouldUseDeterministicBuilds: true,
preferredBuildProviderType: BuildProviderType.GitHubActions,
preferredBuildAgentOperatingSystem: PlatformFamily.Linux);

BuildParameters.PrintParameters(Context);

ToolSettings.SetToolSettings(context: Context);

Build.RunDotNetCore();
Loading

0 comments on commit 234534e

Please sign in to comment.