diff --git a/.github/workflows/cd-release-preview.yml b/.github/workflows/cd-release-preview.yml
index c593cc6..b2628ea 100644
--- a/.github/workflows/cd-release-preview.yml
+++ b/.github/workflows/cd-release-preview.yml
@@ -3,12 +3,11 @@ name: "2. Continuous Deployment (Release Preview)"
on:
push:
tags:
- - "v[0-9]+\\.[0-9]+\\.[0-9]+-preview[0-9]+\\.[0-9]+"
+ - "v[0-9]+\\.[0-9]+\\.[0-9]+-preview.*"
jobs:
build:
runs-on: ubuntu-latest
-
timeout-minutes: 15
steps:
diff --git a/.github/workflows/cd-release.yml b/.github/workflows/cd-release.yml
index d1a87d0..934032e 100644
--- a/.github/workflows/cd-release.yml
+++ b/.github/workflows/cd-release.yml
@@ -1,4 +1,4 @@
-name: "2. Continuous Deployment (Release)"
+name: "2. Continuous Deployment (Release)"
on:
push:
diff --git a/.github/workflows/code-coverage.yml b/.github/workflows/code-coverage.yml
index 0d068db..6a7e24e 100644
--- a/.github/workflows/code-coverage.yml
+++ b/.github/workflows/code-coverage.yml
@@ -1,5 +1,8 @@
name: "3. Code Coverage"
+permissions:
+ contents: write
+
on:
push:
branches:
@@ -22,6 +25,7 @@ jobs:
with:
ref: ${{ github.ref }}
fetch-depth: 0
+ token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup .NET
uses: actions/setup-dotnet@v4
@@ -55,25 +59,22 @@ jobs:
name: code-coverage-badge
path: coverage/badge_linecoverage.svg
- - name: Commit coverage badge
+ - name: Commit coverage badge (only on main)
+ if: github.ref == 'refs/heads/main'
run: |
- git config --global user.name 'github-actions[bot]'
- git config --global user.email 'github-actions[bot]@users.noreply.github.com'
+ git config --global user.name "github-actions[bot]"
+ git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Copy badge to root directory
- find . -name badge_linecoverage.svg || echo "Badge not found"
cp coverage/badge_linecoverage.svg ./coverage-badge.svg
- # Force add badge and commit
- git add -f coverage-badge.svg
- if git diff-index --cached --quiet HEAD; then
- echo "No changes to commit"
+ git add coverage-badge.svg
+ if git diff --cached --quiet; then
+ echo "No changes to commit"
else
- git commit -m 'Update coverage badge'
- git push --force
+ git commit -m "Update coverage badge"
+ git push
fi
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print Directory Structure
uses: FiorelaCiroku/XDTesting-Print-Directory-Structure@v1.0.2
diff --git a/CryptoNet.ConsumerTest/CryptoNet.ConsumerTest.csproj b/CryptoNet.ConsumerTest/CryptoNet.ConsumerTest.csproj
new file mode 100644
index 0000000..10c2fa6
--- /dev/null
+++ b/CryptoNet.ConsumerTest/CryptoNet.ConsumerTest.csproj
@@ -0,0 +1,14 @@
+
+
+
+ Exe
+ net8.0
+ enable
+ enable
+
+
+
+
+
+
+
diff --git a/CryptoNet.ConsumerTest/Program.cs b/CryptoNet.ConsumerTest/Program.cs
new file mode 100644
index 0000000..23790aa
--- /dev/null
+++ b/CryptoNet.ConsumerTest/Program.cs
@@ -0,0 +1,11 @@
+namespace CryptoNet.ConsumerTest
+{
+ internal class Program
+ {
+ static void Main(string[] args)
+ {
+ Console.WriteLine("This is only to test if the latest Nuget package is consumable for nuget.net");
+ //todo: implement a test that uses the CryptoNet library
+ }
+ }
+}
diff --git a/CryptoNet.ExtShared/CryptoNet.ExtShared.csproj b/CryptoNet.ExtShared/CryptoNet.ExtShared.csproj
index 9428a2c..d23c335 100644
--- a/CryptoNet.ExtShared/CryptoNet.ExtShared.csproj
+++ b/CryptoNet.ExtShared/CryptoNet.ExtShared.csproj
@@ -9,8 +9,8 @@
-
-
+
+
diff --git a/CryptoNet.UnitTests/CryptoNet.UnitTests.csproj b/CryptoNet.UnitTests/CryptoNet.UnitTests.csproj
index d59fca9..8e676df 100644
--- a/CryptoNet.UnitTests/CryptoNet.UnitTests.csproj
+++ b/CryptoNet.UnitTests/CryptoNet.UnitTests.csproj
@@ -9,23 +9,23 @@
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
+
+
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
-
+
+
+
+
diff --git a/CryptoNet.sln b/CryptoNet.sln
index 613fc99..048fa2b 100644
--- a/CryptoNet.sln
+++ b/CryptoNet.sln
@@ -12,6 +12,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DevOps", "DevOps", "{1733D1
.gitattributes = .gitattributes
.gitignore = .gitignore
build.ps1 = build.ps1
+ .github\workflows\cd-release-preview.yml = .github\workflows\cd-release-preview.yml
.github\workflows\cd-release.yml = .github\workflows\cd-release.yml
.github\workflows\ci.yml = .github\workflows\ci.yml
.github\workflows\code-coverage.yml = .github\workflows\code-coverage.yml
@@ -47,6 +48,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Examples.UnitTests", "Examp
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DSAExample", "Examples\DSAExample\DSAExample.csproj", "{7338899C-D3F0-4268-AAE8-45793979D936}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CryptoNet.ConsumerTest", "CryptoNet.ConsumerTest\CryptoNet.ConsumerTest.csproj", "{6BBC4487-140E-44E1-9703-F9F48E805589}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -89,6 +92,10 @@ Global
{7338899C-D3F0-4268-AAE8-45793979D936}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7338899C-D3F0-4268-AAE8-45793979D936}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7338899C-D3F0-4268-AAE8-45793979D936}.Release|Any CPU.Build.0 = Release|Any CPU
+ {6BBC4487-140E-44E1-9703-F9F48E805589}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {6BBC4487-140E-44E1-9703-F9F48E805589}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {6BBC4487-140E-44E1-9703-F9F48E805589}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {6BBC4487-140E-44E1-9703-F9F48E805589}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/CryptoNet/CryptoNet.csproj b/CryptoNet/CryptoNet.csproj
index 6350371..8ecd099 100644
--- a/CryptoNet/CryptoNet.csproj
+++ b/CryptoNet/CryptoNet.csproj
@@ -46,8 +46,8 @@
Never
-
-
+
+
@@ -59,8 +59,8 @@
-
-
+
+
diff --git a/Examples/AESExample/AESExample.csproj b/Examples/AESExample/AESExample.csproj
index afce79d..690cfd4 100644
--- a/Examples/AESExample/AESExample.csproj
+++ b/Examples/AESExample/AESExample.csproj
@@ -9,7 +9,7 @@
-
+
diff --git a/Examples/DSAExample/DSAExample.cs b/Examples/DSAExample/DSAExample.cs
index 64c646e..63a5cf8 100644
--- a/Examples/DSAExample/DSAExample.cs
+++ b/Examples/DSAExample/DSAExample.cs
@@ -5,8 +5,6 @@
using CryptoNet;
using CryptoNet.ExtShared;
-using System.Runtime.InteropServices;
-
var confidentialMessage = "Watson, can you hear me?";
diff --git a/Examples/DSAExample/DSAExample.csproj b/Examples/DSAExample/DSAExample.csproj
index afce79d..707cac0 100644
--- a/Examples/DSAExample/DSAExample.csproj
+++ b/Examples/DSAExample/DSAExample.csproj
@@ -9,10 +9,11 @@
-
+
+
diff --git a/Examples/Examples.UnitTests/Examples.UnitTests.csproj b/Examples/Examples.UnitTests/Examples.UnitTests.csproj
index 63d7055..92982ae 100644
--- a/Examples/Examples.UnitTests/Examples.UnitTests.csproj
+++ b/Examples/Examples.UnitTests/Examples.UnitTests.csproj
@@ -14,24 +14,24 @@
-
-
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
+
runtime; build; native; contentfiles; analyzers; buildtransitive
all
-
-
-
+
+
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
-
-
-
+
+
+
diff --git a/Examples/RSAExample/RSAExample.csproj b/Examples/RSAExample/RSAExample.csproj
index 88ca774..dbec44c 100644
--- a/Examples/RSAExample/RSAExample.csproj
+++ b/Examples/RSAExample/RSAExample.csproj
@@ -8,7 +8,7 @@
-
+
diff --git a/index.md b/index.md
index 9b558f7..5599988 100644
--- a/index.md
+++ b/index.md
@@ -8,7 +8,7 @@ _layout: landing
[](https://www.nuget.org/packages/CryptoNet/)
[](https://github.com/itbackyard/CryptoNet/actions/workflows/1-ci.yml)
[](https://github.com/itbackyard/CryptoNet)
-
+
[](https://ci.appveyor.com/project/maythamfahmi/cryptonet/branch/main)
# Introduction
diff --git a/run_docs.ps1 b/run_docs.ps1
index e7d63c0..7350ed3 100644
--- a/run_docs.ps1
+++ b/run_docs.ps1
@@ -1,5 +1,10 @@
-Remove-Item .\api -Recurse
-Remove-Item .\_site\. -Recurse
+if (Test-Path ".\api") {
+ Remove-Item ".\api" -Recurse -Force
+}
+
+if (Test-Path ".\_site") {
+ Remove-Item ".\_site" -Recurse -Force
+}
docfx metadata
docfx build .\docfx.json
diff --git a/run_release.ps1 b/run_release.ps1
index e7fc275..0c7a714 100644
--- a/run_release.ps1
+++ b/run_release.ps1
@@ -2,45 +2,47 @@
param(
[Parameter(Mandatory = $true, HelpMessage = "Provide the version number in the format 'X.Y.Z', e.g., '3.0.0'.")]
[string]$VersionNumber,
+
[Parameter(Mandatory = $true)]
[bool]$IsPreview
)
-# Validate the input format
+# Validate version number format X.Y.Z
if ($VersionNumber -notmatch '^\d+\.\d+\.\d+$') {
- Write-Host "Error: Version number must be in the format 'X.Y.Z', e.g., '3.0.0'." -ForegroundColor Red
+ Write-Host "❌ Error: Version number must be in the format 'X.Y.Z', e.g., '3.0.0'." -ForegroundColor Red
exit 1
}
-# Generate PreviewVersion dynamically
-$Timestamp = (Get-Date -Format "ddMMyy")
-$Time = (Get-Date -Format "HHmm")
-$PreviewVersion = "$Timestamp.$Time"
+# Build preview suffix (valid SemVer identifiers, no leading zeros)
+$DatePart = (Get-Date -Format "yyyyMMdd") # e.g. 20250822
+$TimePart = (Get-Date -Format "Hmm") # e.g. 845 (not 0845, no leading zero!)
+$PreviewId = "$DatePart.$TimePart" # → "20250822.845"
-# Construct the tag and message dynamically
+# Construct the tag
if ($IsPreview) {
- $TagName = "v$VersionNumber-preview$PreviewVersion"
+ # format: vX.Y.Z-preview.YYYYMMDD.HHmm
+ $TagName = "v$VersionNumber-preview.$PreviewId"
} else {
$TagName = "v$VersionNumber"
}
$Message = "Release version $TagName"
-# Display confirmation prompt
-Write-Host "You are about to release:" -ForegroundColor Yellow
-Write-Host "Tag: $TagName" -ForegroundColor Cyan
-Write-Host "Message: $Message" -ForegroundColor Cyan
+# Confirm with user
+Write-Host "🚀 You are about to release:" -ForegroundColor Yellow
+Write-Host " Tag: $TagName" -ForegroundColor Cyan
+Write-Host " Message: $Message" -ForegroundColor Cyan
$response = Read-Host "Are you sure you want to proceed? (yes/no)"
if ($response -ne "yes") {
- Write-Host "Release canceled by the user." -ForegroundColor Red
+ Write-Host "❌ Release canceled by the user." -ForegroundColor Red
exit 0
}
-# Execute the git commands
-Write-Host "Creating tag $TagName with message: $Message"
+# Git commands
+Write-Host "🔖 Creating tag $TagName with message: $Message"
git tag -a $TagName -m $Message
-Write-Host "Pushing tag $TagName to origin"
+Write-Host "⬆️ Pushing tag $TagName to origin"
git push origin $TagName
-Write-Host "Tag $TagName pushed successfully." -ForegroundColor Green
+Write-Host "✅ Tag $TagName pushed successfully." -ForegroundColor Green