diff --git a/.github/workflows/master-pr.yml b/.github/workflows/master-pr.yml new file mode 100644 index 0000000..1193a75 --- /dev/null +++ b/.github/workflows/master-pr.yml @@ -0,0 +1,37 @@ +on: + pull_request: + branches: + - master + +jobs: + check-pr-version: + runs-on: ubuntu-latest + steps: + - name: Checkout PR branch + uses: actions/checkout@v3 + + - name: Get version from PR branch + id: pr_version + run: | + PR_VERSION=$(grep '' **/*.csproj | sed -E 's/.*(.*)<\/Version>.*/\1/') + echo "PR_VERSION=$PR_VERSION" >> $GITHUB_ENV + + - name: Checkout master branch + run: | + git fetch origin master + git checkout origin/master + + - name: Get version from master branch + id: master_version + run: | + MASTER_VERSION=$(grep '' **/*.csproj | sed -E 's/.*(.*)<\/Version>.*/\1/') + echo "MASTER_VERSION=$MASTER_VERSION" >> $GITHUB_ENV + + - name: Compare versions + run: | + if [ "$(printf '%s\n' "$PR_VERSION" "$MASTER_VERSION" | sort -V | head -n1)" = "$PR_VERSION" ] && [ "$PR_VERSION" != "$MASTER_VERSION" ]; then + echo "Version in PR is not higher than master." + exit 1 + else + echo "Version in PR is higher than master." + fi diff --git a/.github/workflows/release-nuget.yml b/.github/workflows/release-nuget.yml new file mode 100644 index 0000000..cc90ca5 --- /dev/null +++ b/.github/workflows/release-nuget.yml @@ -0,0 +1,30 @@ +on: + release: + types: [published] + +jobs: + release-nuget: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v2 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Restore dependencies + run: dotnet restore src/DotTiled.sln + - name: Build + run: dotnet build --no-restore src/DotTiled.sln + - name: Test + run: dotnet test --no-build --verbosity normal src/DotTiled.sln + - name: Lint style + run: dotnet format style --verify-no-changes --verbosity diagnostic src/DotTiled.sln + - name: Lint analyzers + run: dotnet format analyzers --verify-no-changes --verbosity diagnostic src/DotTiled.sln + - name: Pack + run: make pack + - name: Publish to NuGet.org + run: | + dotnet nuget push ./nupkg/*.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate + dotnet nuget push ./nupkg/*.snupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json --skip-duplicate diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c6014ab --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 Daniel Cronqvist (daniel@dcronqvist.se) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/Makefile b/Makefile index 14a40ab..601eda2 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,13 @@ lint: dotnet format style --verify-no-changes src/DotTiled.sln dotnet format analyzers --verify-no-changes src/DotTiled.sln +pack: + dotnet pack src/DotTiled/DotTiled.csproj -c Release -o ./nupkg -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg + BENCHMARK_SOURCES = src/DotTiled.Benchmark/Program.cs src/DotTiled.Benchmark/DotTiled.Benchmark.csproj BENCHMARK_OUTPUTDIR = src/DotTiled.Benchmark/BenchmarkDotNet.Artifacts .PHONY: benchmark benchmark: $(BENCHMARK_OUTPUTDIR)/results/MyBenchmarks.MapLoading-report-github.md - + $(BENCHMARK_OUTPUTDIR)/results/MyBenchmarks.MapLoading-report-github.md: $(BENCHMARK_SOURCES) dotnet run --project src/DotTiled.Benchmark/DotTiled.Benchmark.csproj -c Release -- $(BENCHMARK_OUTPUTDIR) \ No newline at end of file diff --git a/src/DotTiled/DotTiled.csproj b/src/DotTiled/DotTiled.csproj index 0a2dfe8..d00569d 100644 --- a/src/DotTiled/DotTiled.csproj +++ b/src/DotTiled/DotTiled.csproj @@ -6,4 +6,25 @@ true + + DotTiled + dcronqvist + DotTiled + DotTiled is a general-purpose Tiled map parser for all your .NET needs. + git + https://github.com/dcronqvist/DotTiled + README.md + gamedev;window;parser;tiled;mapeditor + https://github.com/dcronqvist/DotTiled + true + Copyright © 2024 dcronqvist + LICENSE + 1.0.0 + + + + + + +