diff --git a/.editorconfig b/.editorconfig
index a76b4ba..41b1bd7 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -7,3 +7,7 @@ insert_final_newline = true
trim_trailing_whitespace = true
indent_style = tab
indent_size = 4
+
+[*.{yml,yaml}]
+indent_style = space
+indent_size = 2
diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml
new file mode 100644
index 0000000..2b57dea
--- /dev/null
+++ b/.github/workflows/publish.yaml
@@ -0,0 +1,37 @@
+name: Publish To NuGet
+
+on:
+ release: # NOTE: See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#release
+ types:
+ - published
+
+jobs:
+ # TODO: Have this depend on `test.yaml`
+ publish:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout the repository
+ uses: actions/checkout@v3
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: "7.x" # TODO: Specify multiple .NET versions once we add support for other target frameworks
+
+ - name: Generate the package
+ # NOTE: As for the `${GITHUB_REF_NAME#v}` bit below, see https://docs.github.com/en/actions/learn-github-actions/variables#default-environment-variables:~:text=branch%2D1.-,GITHUB_REF_NAME,-The%20short%20ref. We could've also done https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#setting-an-environment-variable but since we're using this value in a single place, we don't need to make it an environment variable.
+ run: |
+ dotnet pack \
+ --configuration Release
+ --output _nuget
+ -p:PackageVersion=${GITHUB_REF_NAME#v}
+
+ # TODO: Changelog?
+
+ - name: Push the package to NuGet
+ run: |
+ dotnet nuget push \
+ _nuget\*.nupkg
+ --source https://api.nuget.org/v3/index.json
+ --api-key ${{ secrets.NUGET_API_KEY }}
diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml
new file mode 100644
index 0000000..cbcd2e2
--- /dev/null
+++ b/.github/workflows/test.yaml
@@ -0,0 +1,23 @@
+name: Run Tests
+
+on:
+ pull_request:
+ branches:
+ - main
+
+jobs:
+ test:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout the repository
+ uses: actions/checkout@v3
+
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: "7.x" # TODO: Specify multiple .NET versions once we add support for other target frameworks
+
+ # TODO: Some .NET codebases with GitHub Actions workflows seem to run `dotnet restore`, `dotnet build` and `dotnet test` as separate steps. Why?
+ - name: Run the tests
+ run: dotnet test --configuration Release
diff --git a/.vscode/settings.json b/.vscode/settings.json
index f4bc1f5..ee9b8b8 100644
--- a/.vscode/settings.json
+++ b/.vscode/settings.json
@@ -1,3 +1,3 @@
{
- "cSpell.words": ["Parallelizable", "sqids"]
+ "cSpell.words": ["nupkg", "Parallelizable", "sqids"]
}
diff --git a/src/Sqids/Sqids.csproj b/src/Sqids/Sqids.csproj
index e5ed76c..c033da1 100644
--- a/src/Sqids/Sqids.csproj
+++ b/src/Sqids/Sqids.csproj
@@ -8,9 +8,7 @@
Library
Sqids
- 1.0.4
Official .NET port of Sqids. Generate short YouTube-looking IDs from numbers.
- true
Sqids;ID-generator;number-obfuscator;YouTube-ID
https://raw.githubusercontent.com/sqids/sqids-dotnet/main/icon.png
icon.png