diff --git a/.github/hooks/commit-msg b/.github/hooks/commit-msg
new file mode 100644
index 0000000..2ec4505
--- /dev/null
+++ b/.github/hooks/commit-msg
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# An example hook script to check the commit log message.
+# Called by "git commit" with one argument, the name of the file
+# that has the commit message. The hook should exit with non-zero
+# status after issuing an appropriate message if it wants to stop the
+# commit. The hook is allowed to edit the commit message file.
+#
+# To enable this hook, rename this file to "commit-msg".
+
+# Uncomment the below to add a Signed-off-by line to the message.
+# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
+# hook is more suited to it.
+#
+# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
+# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
+
+# This example catches duplicate Signed-off-by lines.
+
+test "" = "$(grep '^Signed-off-by: ' "$1" |
+ sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
+ echo >&2 Duplicate Signed-off-by lines.
+ exit 1
+}
+if ! head -1 "$1" | grep -qE "^(feat|fix|ci|chore|docs|test|style|refactor|chk)(\(.+?\))?: .{1,}$"; then
+ echo "Aborting commit. Your commit message is invalid. See some examples below:" >&2
+ echo "feat(logging): added logs for failed signups" >&2
+ echo "fix(homepage): fixed image gallery" >&2
+ echo "test(homepage): updated tests" >&2
+ echo "docs(readme): added new logging table information" >&2
+ echo "For more information check https://www.conventionalcommits.org/en/v1.0.0/ for more details" >&2
+ exit 1
+fi
+if ! head -1 "$1" | grep -qE "^.{1,50}$"; then
+ echo "Aborting commit. Your commit message is too long." >&2
+ exit 1
+fi
\ No newline at end of file
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
new file mode 100644
index 0000000..1e41b22
--- /dev/null
+++ b/.github/workflows/dotnet.yml
@@ -0,0 +1,51 @@
+name: NetDevPack Brasil - MASTER Deploy
+on:
+ push:
+ branches: [ master ]
+ pull_request:
+ types: [closed]
+ branches: [ master ]
+
+env:
+ REPOSITORY_URL: https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json
+ CURRENT_REPO_URL: https://github.com/${{ github.repository }}
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v2
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 5.0.x
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --no-restore
+
+ - name: Test
+ run: dotnet test
+
+ - name: Semantic Release
+ id: semantic
+ uses: cycjimmy/semantic-release-action@v2
+ with:
+ semantic_version: 17.4.4
+ extra_plugins: |
+ @semantic-release/changelog
+ @semantic-release/github
+ @semantic-release/git
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Generate Package
+ run: dotnet pack -c Release -o out -p:PackageVersion=${{ steps.semantic.outputs.new_release_version }} -p:RepositoryUrl=${{env.CURRENT_REPO_URL}}
+
+ - name: Publish the package to nuget.org
+ run: dotnet nuget push ./out/*.nupkg --skip-duplicate --no-symbols true -k ${{ secrets.NUGET_AUTH_TOKEN}} -s https://api.nuget.org/v3/index.json
\ No newline at end of file
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
new file mode 100644
index 0000000..7ad0bd6
--- /dev/null
+++ b/.github/workflows/pull-request.yml
@@ -0,0 +1,24 @@
+name: NetDevPack Brasil - MASTER PR
+on:
+ pull_request:
+ branches: [ master ]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 5.0.x
+
+ - name: Restore dependencies
+ run: dotnet restore
+
+ - name: Build
+ run: dotnet build --no-restore
+
+ - name: Test
+ run: dotnet test --no-build --verbosity normal
\ No newline at end of file
diff --git a/.releaserc b/.releaserc
new file mode 100644
index 0000000..ce9cb40
--- /dev/null
+++ b/.releaserc
@@ -0,0 +1,11 @@
+{
+ "branches": ["master"],
+
+ "plugins": [
+ "@semantic-release/commit-analyzer",
+ "@semantic-release/release-notes-generator",
+ "@semantic-release/changelog",
+ "@semantic-release/github",
+ "@semantic-release/git"
+ ]
+}
\ No newline at end of file
diff --git a/src/NetDevPack.Brasil/Documentos/CNPJ.cs b/src/NetDevPack.Brasil/Documentos/CNPJ.cs
index 93a183b..410d12a 100644
--- a/src/NetDevPack.Brasil/Documentos/CNPJ.cs
+++ b/src/NetDevPack.Brasil/Documentos/CNPJ.cs
@@ -1,7 +1,7 @@
-using System;
+using NetDevPack.Brasil.Documentos.Validacao;
using NetDevPack.Domain;
using NetDevPack.Utilities;
-using NetDevPack.Brasil.Documentos.Validacao;
+using System;
namespace NetDevPack.Brasil.Documentos
{
@@ -12,7 +12,7 @@ public class Cnpj
public Cnpj(string numero)
{
Numero = numero.OnlyNumbers(numero);
- if (!EstaValido()) throw new DomainException("CNPJ Inválido");
+ if (!EstaValido()) throw new DomainException("CNPJ Invalido");
}
public override string ToString() => SemMascara();
diff --git a/src/NetDevPack.Brasil/Documentos/Cpf.cs b/src/NetDevPack.Brasil/Documentos/Cpf.cs
index cc1f587..86d51a3 100644
--- a/src/NetDevPack.Brasil/Documentos/Cpf.cs
+++ b/src/NetDevPack.Brasil/Documentos/Cpf.cs
@@ -1,7 +1,7 @@
-using System;
+using NetDevPack.Brasil.Documentos.Validacao;
using NetDevPack.Domain;
using NetDevPack.Utilities;
-using NetDevPack.Brasil.Documentos.Validacao;
+using System;
namespace NetDevPack.Brasil.Documentos
{
@@ -12,7 +12,7 @@ public class Cpf
public Cpf(string numero)
{
Numero = numero.OnlyNumbers(numero);
- if (!EstaValido()) throw new DomainException("CPF Inválido");
+ if (!EstaValido()) throw new DomainException("CPF Invalido");
}
public override string ToString() => SemMascara();
diff --git a/src/NetDevPack.Brasil/NetDevPack.Brasil.csproj b/src/NetDevPack.Brasil/NetDevPack.Brasil.csproj
index 3e4d9d7..6ce4255 100644
--- a/src/NetDevPack.Brasil/NetDevPack.Brasil.csproj
+++ b/src/NetDevPack.Brasil/NetDevPack.Brasil.csproj
@@ -29,4 +29,11 @@
+
+
+ <_CustomFiles Include="../../.github/hooks/commit-msg" />
+
+
+
+
diff --git a/tests/NetDevPack.Brasil.Tests/Documentos/CnpjValidadorTest.cs b/tests/NetDevPack.Brasil.Tests/Documentos/CnpjValidadorTest.cs
index 048cf9e..e5c23b1 100644
--- a/tests/NetDevPack.Brasil.Tests/Documentos/CnpjValidadorTest.cs
+++ b/tests/NetDevPack.Brasil.Tests/Documentos/CnpjValidadorTest.cs
@@ -27,7 +27,7 @@ public void Cnpj_PossuiDigitosRepetidos_ShouldReturnDomainException(string value
Action act = () => new Cnpj(value);
// Assert
- act.Should().ThrowExactly().WithMessage("CNPJ Inválido");
+ act.Should().ThrowExactly().WithMessage("CNPJ Invalido");
}
[Fact(DisplayName = "Cnpj ReturnTrue")]
@@ -38,7 +38,7 @@ public void Cnpj_NewCnpj_ShouldReturnNewCnpj()
var cnpj = new Cnpj("30.221.805/0001-26");
// Act
- var result = new CnpjValidador(cnpj.Numero).EstaValido();
+ var result = new CnpjValidador(cnpj.Numero).EstaValido();
// Assert
result.Should().BeTrue();
diff --git a/tests/NetDevPack.Brasil.Tests/Documentos/CpfValidadorTest.cs b/tests/NetDevPack.Brasil.Tests/Documentos/CpfValidadorTest.cs
index 5c09e34..24fdc39 100644
--- a/tests/NetDevPack.Brasil.Tests/Documentos/CpfValidadorTest.cs
+++ b/tests/NetDevPack.Brasil.Tests/Documentos/CpfValidadorTest.cs
@@ -27,7 +27,7 @@ public void Cpf_PossuiDigitosRepetidos_ShouldReturnDomainException(string value)
Action act = () => new Cpf(value);
// Assert
- act.Should().ThrowExactly().WithMessage("CPF Inválido");
+ act.Should().ThrowExactly().WithMessage("CPF Invalido");
}
[Fact(DisplayName = "Cpf ReturnTrue")]
@@ -38,7 +38,7 @@ public void Cpf_NewCpf_ShouldReturnNewCpf()
var cpf = new Cpf("915.212.540-87");
// Act
- var result = new CpfValidador(cpf.Numero).EstaValido();
+ var result = new CpfValidador(cpf.Numero).EstaValido();
// Assert
result.Should().BeTrue();