Skip to content

Commit

Permalink
Initial commit (#1)
Browse files Browse the repository at this point in the history
* initial commit

* added Dependabot

* initial commit
  • Loading branch information
Aaronontheweb authored Jan 3, 2025
1 parent 6d5fedf commit 96f9898
Show file tree
Hide file tree
Showing 22 changed files with 374 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2

updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: daily
time: "11:00"

- package-ecosystem: nuget
directory: "/"
schedule:
interval: daily
time: "11:00"
40 changes: 40 additions & 0 deletions .github/workflows/pr_validation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: pr_validation

on:
push:
branches:
- master
- dev
- main
pull_request:
branches:
- master
- dev
- main

jobs:
test:
name: Test-${{matrix.os}}
runs-on: ${{matrix.os}}

strategy:
matrix:
os: [ubuntu-latest]

steps:
- name: "Checkout"
uses: actions/[email protected]
with:
lfs: true
fetch-depth: 0

- name: "Install .NET SDK"
uses: actions/[email protected]
with:
global-json-file: "./global.json"

- name: "dotnet build"
run: dotnet build -c Release

- name: "dotnet test"
run: dotnet test -c Release
13 changes: 13 additions & 0 deletions .idea/.idea.LinkValidator/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.idea.LinkValidator/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.LinkValidator/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.LinkValidator/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.LinkValidator/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

33 changes: 33 additions & 0 deletions LinkValidator.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.0.31903.59
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{30006747-5ED8-4FAE-8444-C267675556C7}"
ProjectSection(SolutionItems) = preProject
global.json = global.json
build.ps1 = build.ps1
README.md = README.md
RELEASE_NOTES.md = RELEASE_NOTES.md
src\Directory.Build.props = src\Directory.Build.props
src\Directory.Packages.props = src\Directory.Packages.props
src\NuGet.config = src\NuGet.config
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "LinkValidator", "src\LinkValidator\LinkValidator.csproj", "{735F5CB0-2BD5-4BE4-86FF-794EF5519E78}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{735F5CB0-2BD5-4BE4-86FF-794EF5519E78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{735F5CB0-2BD5-4BE4-86FF-794EF5519E78}.Debug|Any CPU.Build.0 = Debug|Any CPU
{735F5CB0-2BD5-4BE4-86FF-794EF5519E78}.Release|Any CPU.ActiveCfg = Release|Any CPU
{735F5CB0-2BD5-4BE4-86FF-794EF5519E78}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#### 0.1.0 Januard 3rd 2025 ####

Initial release
15 changes: 15 additions & 0 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
. "$PSScriptRoot\scripts\getReleaseNotes.ps1"
. "$PSScriptRoot\scripts\bumpVersion.ps1"

######################################################################
# Step 1: Grab release notes and update solution metadata
######################################################################
$releaseNotes = Get-ReleaseNotes -MarkdownFile (Join-Path -Path $PSScriptRoot -ChildPath "RELEASE_NOTES.md")

# inject release notes into Directory.Build.props
$directoryBuildPropsPath = Join-Path -Path $PSScriptRoot -ChildPath "src"
$directoryBuildPropsPath = Join-Path -Path $directoryBuildPropsPath -ChildPath "Directory.Build.props"

UpdateVersionAndReleaseNotes -ReleaseNotesResult $releaseNotes -XmlFilePath $directoryBuildPropsPath

Write-Output "Added release notes $releaseNotes"
6 changes: 6 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"sdk": {
"rollForward": "latestMinor",
"version": "9.0.101"
}
}
28 changes: 28 additions & 0 deletions scripts/bumpVersion.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
function UpdateVersionAndReleaseNotes {
param (
[Parameter(Mandatory=$true)]
[PSCustomObject]$ReleaseNotesResult,

[Parameter(Mandatory=$true)]
[string]$XmlFilePath
)

# Load XML
$xmlContent = New-Object XML
$xmlContent.Load($XmlFilePath)

# Update VersionPrefix and PackageReleaseNotes
$versionPrefixElement = $xmlContent.SelectSingleNode("//VersionPrefix")
$versionPrefixElement.InnerText = $ReleaseNotesResult.Version

$packageReleaseNotesElement = $xmlContent.SelectSingleNode("//PackageReleaseNotes")
$packageReleaseNotesElement.InnerText = $ReleaseNotesResult.ReleaseNotes

# Save the updated XML
$xmlContent.Save($XmlFilePath)
}

# Usage example:
# $notes = Get-ReleaseNotes -MarkdownFile "$PSScriptRoot\RELEASE_NOTES.md"
# $propsPath = Join-Path -Path (Get-Item $PSScriptRoot).Parent.FullName -ChildPath "Directory.Build.props"
# UpdateVersionAndReleaseNotes -ReleaseNotesResult $notes -XmlFilePath $propsPath
44 changes: 44 additions & 0 deletions scripts/getReleaseNotes.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
function Get-ReleaseNotes {
param (
[Parameter(Mandatory=$true)]
[string]$MarkdownFile
)

# Read markdown file content
$content = Get-Content -Path $MarkdownFile -Raw

# Split content based on headers
$sections = $content -split "####"

# Output object to store result
$outputObject = [PSCustomObject]@{
Version = $null
Date = $null
ReleaseNotes = $null
}

# Check if we have at least 3 sections (1. Before the header, 2. Header, 3. Release notes)
if ($sections.Count -ge 3) {
$header = $sections[1].Trim()
$releaseNotes = $sections[2].Trim()

# Extract version and date from the header
$headerParts = $header -split " ", 2
if ($headerParts.Count -eq 2) {
$outputObject.Version = $headerParts[0]
$outputObject.Date = $headerParts[1]
}

$outputObject.ReleaseNotes = $releaseNotes
}

# Return the output object
return $outputObject
}

# Call function example:
#$result = Get-ReleaseNotes -MarkdownFile "$PSScriptRoot\RELEASE_NOTES.md"
#Write-Output "Version: $($result.Version)"
#Write-Output "Date: $($result.Date)"
#Write-Output "Release Notes:"
#Write-Output $result.ReleaseNotes
49 changes: 49 additions & 0 deletions scripts/signPackages.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
param(
[string]$ConfigPath,
[string]$UserName,
[string]$Password,
[string]$ProductName,
[string]$ProductDescription,
[string]$ProductUrl,
[string]$DirectoryPath
)

# Logging the received parameters (optional, for debugging)
Write-Output "Using configuration: $ConfigPath"
Write-Output "Product Name: $ProductName"
Write-Output "Product Description: $ProductDescription"
Write-Output "Product URL: $ProductUrl"
Write-Output "Directory for signing: $DirectoryPath"

# Validate that the directory exists
if (-Not (Test-Path $DirectoryPath)) {
Write-Error "Directory does not exist: $DirectoryPath"
exit 1
}

# Loop over each .nupkg and .snupkg file in the directory
Get-ChildItem -Path $DirectoryPath -Include *.nupkg,*.snupkg -Recurse | ForEach-Object {
$filePath = $_.FullName

Write-Output "Signing file: $filePath"

# Define the command and parameters
$command = "SignClient"
$arguments = "--config", $ConfigPath,
"-r", $UserName,
"-s", $Password,
"-n", $ProductName,
"-d", $ProductDescription,
"-u", $ProductUrl,
"-i", $filePath

# Execute SignClient and capture the output directly
try {
SignClient sign $arguments
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to sign $filePath."
}
} catch {
Write-Error "An error occurred: $_"
}
}
13 changes: 13 additions & 0 deletions scripts/signsettings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"SignClient": {
"AzureAd": {
"AADInstance": "https://login.microsoftonline.com/",
"ClientId": "1e983f21-9ea5-4f21-ab99-28080225efc9",
"TenantId": "2fa36080-af12-4894-a64b-a17d8f29ec52"
},
"Service": {
"Url": "https://pb-sign.azurewebsites.net/",
"ResourceId": "https://SignService/eef8e2e7-24b1-4a3b-a73b-a84d66f9abee"
}
}
}
20 changes: 20 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<Project>
<PropertyGroup>
<Copyright>Copyright © 2019-2024 Aaron Stannard</Copyright>
<Authors>Aaron Stannard</Authors>
<VersionPrefix>0.1.0</VersionPrefix>
<PackageReleaseNotes>Initial release</PackageReleaseNotes>
<PackageIconUrl>
</PackageIconUrl>
<PackageProjectUrl>
https://github.com/Aaronontheweb/tailscale-pulumi
</PackageProjectUrl>
<PackageLicenseUrl>
</PackageLicenseUrl>
<NoWarn>$(NoWarn);CS1591</NoWarn>
</PropertyGroup>
<PropertyGroup Label="SharedBuildProperties">
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
</PropertyGroup>
</Project>
10 changes: 10 additions & 0 deletions src/Directory.Packages.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<PropertyGroup>
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Akka" Version="1.5.33" />
<PackageVersion Include="HtmlAgilityPack" Version="1.11.72" />
<PackageVersion Include="System.CommandLine" Version="2.0.0-beta4.22272.1" />
</ItemGroup>
</Project>
12 changes: 12 additions & 0 deletions src/LinkValidator/Actors/CrawlerActor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using System.Collections.Immutable;

namespace LinkValidator.Actors;

public record CrawlUrl(string Url);
public record PageCrawled(string Url, int StatusCode, IReadOnlyCollection<string> Links);
public record CrawlComplete(ImmutableDictionary<string, (int StatusCode, string Path)> Results);

public class CrawlerActor
{

}
11 changes: 11 additions & 0 deletions src/LinkValidator/Actors/IndexerActor.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using Akka.Actor;

namespace LinkValidator.Actors;

public sealed class IndexerActor : UntypedActor
{
protected override void OnReceive(object message)
{

}
}
16 changes: 16 additions & 0 deletions src/LinkValidator/LinkValidator.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Akka" />
<PackageReference Include="HtmlAgilityPack" />
<PackageReference Include="System.CommandLine" />
</ItemGroup>

</Project>
9 changes: 9 additions & 0 deletions src/LinkValidator/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace LinkValidator;

class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
}
}
Loading

0 comments on commit 96f9898

Please sign in to comment.