From 678427b55cfc2b0c9e1fd03542016ec002b6c780 Mon Sep 17 00:00:00 2001 From: Latency McLaughlin Date: Thu, 15 Feb 2024 14:44:01 -0700 Subject: [PATCH 1/2] Update for .NET standard 2.1 --- src/JsonEasyNavigation/ArrayEnumeratorWrapper.cs | 5 +---- src/JsonEasyNavigation/BoxingSafeConverter.cs | 3 +-- src/JsonEasyNavigation/JsonEasyNavigation.csproj | 14 +++++++++----- src/JsonEasyNavigation/JsonExtensions.cs | 7 +------ .../JsonNavigationElement.ReadOnlyDictionary.cs | 6 +----- .../JsonNavigationElement.ReadOnlyList.cs | 6 +----- src/JsonEasyNavigation/JsonNavigationElement.cs | 9 +-------- src/JsonEasyNavigation/ObjectEnumeratorWrapper.cs | 6 +----- src/JsonEasyNavigation/PrimitiveValueExtractor.cs | 6 +----- src/JsonEasyNavigation/PropertyPathVisitor.cs | 6 +----- src/JsonEasyNavigation/Usings.cs | 1 + 11 files changed, 19 insertions(+), 50 deletions(-) create mode 100644 src/JsonEasyNavigation/Usings.cs diff --git a/src/JsonEasyNavigation/ArrayEnumeratorWrapper.cs b/src/JsonEasyNavigation/ArrayEnumeratorWrapper.cs index 6eb5dfc..21ecb18 100644 --- a/src/JsonEasyNavigation/ArrayEnumeratorWrapper.cs +++ b/src/JsonEasyNavigation/ArrayEnumeratorWrapper.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text.Json; +using System.Collections; namespace JsonEasyNavigation { diff --git a/src/JsonEasyNavigation/BoxingSafeConverter.cs b/src/JsonEasyNavigation/BoxingSafeConverter.cs index b5b8527..fc37c5c 100644 --- a/src/JsonEasyNavigation/BoxingSafeConverter.cs +++ b/src/JsonEasyNavigation/BoxingSafeConverter.cs @@ -1,5 +1,4 @@ -using System; -using System.Linq.Expressions; +using System.Linq.Expressions; namespace JsonEasyNavigation { diff --git a/src/JsonEasyNavigation/JsonEasyNavigation.csproj b/src/JsonEasyNavigation/JsonEasyNavigation.csproj index 884fc1a..0b46ceb 100644 --- a/src/JsonEasyNavigation/JsonEasyNavigation.csproj +++ b/src/JsonEasyNavigation/JsonEasyNavigation.csproj @@ -1,9 +1,9 @@ - + - net5.0;netstandard2.0 + netstandard2.0;netstandard2.1 True - 1.3.0 + 1.3.1 logo.png JsonEasyNavigation Sharkadi Andrey @@ -11,9 +11,13 @@ (c) Sharkadi Andrey https://github.com/sharkadi-a/JsonEasyNavigation text.json json navigation indexer dictionary list collection DOM + enable + preview + Apache-2.0 + README.md @@ -25,11 +29,11 @@ - + - + diff --git a/src/JsonEasyNavigation/JsonExtensions.cs b/src/JsonEasyNavigation/JsonExtensions.cs index dde1c53..b0fae6d 100644 --- a/src/JsonEasyNavigation/JsonExtensions.cs +++ b/src/JsonEasyNavigation/JsonExtensions.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; - -namespace JsonEasyNavigation +namespace JsonEasyNavigation { /// /// Various , and extensions diff --git a/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyDictionary.cs b/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyDictionary.cs index 0f3a6c9..54256ab 100644 --- a/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyDictionary.cs +++ b/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyDictionary.cs @@ -1,8 +1,4 @@ -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; - -namespace JsonEasyNavigation +namespace JsonEasyNavigation { public readonly partial struct JsonNavigationElement : IReadOnlyDictionary { diff --git a/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyList.cs b/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyList.cs index 3274ec1..935fc77 100644 --- a/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyList.cs +++ b/src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyList.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; +using System.Collections; namespace JsonEasyNavigation { diff --git a/src/JsonEasyNavigation/JsonNavigationElement.cs b/src/JsonEasyNavigation/JsonNavigationElement.cs index 384c07a..8e01302 100644 --- a/src/JsonEasyNavigation/JsonNavigationElement.cs +++ b/src/JsonEasyNavigation/JsonNavigationElement.cs @@ -1,11 +1,4 @@ -using System; -using System.Buffers; -using System.IO; -using System.Linq; -using System.Text.Json; -using System.Threading; - -namespace JsonEasyNavigation +namespace JsonEasyNavigation { /// /// Represents a wrapper around , which allows to navigate it's diff --git a/src/JsonEasyNavigation/ObjectEnumeratorWrapper.cs b/src/JsonEasyNavigation/ObjectEnumeratorWrapper.cs index 068fc53..83d7cf0 100644 --- a/src/JsonEasyNavigation/ObjectEnumeratorWrapper.cs +++ b/src/JsonEasyNavigation/ObjectEnumeratorWrapper.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Linq; -using System.Text.Json; +using System.Collections; namespace JsonEasyNavigation { diff --git a/src/JsonEasyNavigation/PrimitiveValueExtractor.cs b/src/JsonEasyNavigation/PrimitiveValueExtractor.cs index fe655af..c369731 100644 --- a/src/JsonEasyNavigation/PrimitiveValueExtractor.cs +++ b/src/JsonEasyNavigation/PrimitiveValueExtractor.cs @@ -1,8 +1,4 @@ -using System; -using System.IO; -using System.Text.Json; - -namespace JsonEasyNavigation +namespace JsonEasyNavigation { internal static class PrimitiveValueExtractor { diff --git a/src/JsonEasyNavigation/PropertyPathVisitor.cs b/src/JsonEasyNavigation/PropertyPathVisitor.cs index a991a63..df4256a 100644 --- a/src/JsonEasyNavigation/PropertyPathVisitor.cs +++ b/src/JsonEasyNavigation/PropertyPathVisitor.cs @@ -1,8 +1,4 @@ -using System; -using System.Linq; -using System.Text.Json; - -namespace JsonEasyNavigation +namespace JsonEasyNavigation { internal static class PropertyPathVisitor { diff --git a/src/JsonEasyNavigation/Usings.cs b/src/JsonEasyNavigation/Usings.cs new file mode 100644 index 0000000..f669328 --- /dev/null +++ b/src/JsonEasyNavigation/Usings.cs @@ -0,0 +1 @@ +global using System.Text.Json; \ No newline at end of file From 2583ab5d92eb5a911bc24d94fdfcbbea7e6466bc Mon Sep 17 00:00:00 2001 From: Latency McLaughlin Date: Tue, 17 Sep 2024 19:35:36 -0700 Subject: [PATCH 2/2] Update target framework version for .NET 9.0 --- .github/FUNDING.yml | 14 + .github/ISSUE_TEMPLATE/bug_report.md | 38 ++ .github/ISSUE_TEMPLATE/feature_request.md | 20 ++ .github/workflows/Test.yml | 54 +++ .github/workflows/delete_workflows.yml | 76 ++++ .github/workflows/dotnet.yml | 60 +++- .github/workflows/publish.yml | 57 --- .github/workflows/release.yml | 157 ++++++++ .gitignore | 146 +++++--- JsonEasyNavigation.sln | 31 ++ LICENSE.txt | 201 ----------- MIT-LICENSE.txt | 20 ++ Unit Tests/ArrayTests.cs | 138 +++++++ Unit Tests/CachedPropertiesTests.cs | 74 ++++ Unit Tests/ExtensionsTests.cs | 64 ++++ Unit Tests/JsonEasyNavigation.Tests.csproj | 17 + Unit Tests/MappingTests.cs | 112 ++++++ Unit Tests/NumberTests.cs | 164 +++++++++ Unit Tests/PropertyTests.cs | 281 +++++++++++++++ ...lePropertyOrderAndCachedPropertiesTests.cs | 95 +++++ Unit Tests/StablePropertyOrderTests.cs | 104 ++++++ Unit Tests/ValueKindsTests.cs | 213 +++++++++++ media/logo.xcf | Bin 19080 -> 0 bytes src/ArrayEnumeratorWrapper.cs | 25 ++ src/BoxingSafeConverter.cs | 20 ++ src/JsonEasyNavigation.Tests/ArrayTests.cs | 144 -------- .../CachedPropertiesTests.cs | 80 ----- .../ExtensionsTests.cs | 67 ---- .../JsonEasyNavigation.Tests.csproj | 27 -- src/JsonEasyNavigation.Tests/MappingTests.cs | 109 ------ src/JsonEasyNavigation.Tests/NumberTests.cs | 167 --------- src/JsonEasyNavigation.Tests/PropertyTests.cs | 306 ---------------- ...lePropertyOrderAndCachedPropertiesTests.cs | 103 ------ .../StablePropertyOrderTests.cs | 115 ------ .../ValueKindsTests.cs | 223 ------------ src/JsonEasyNavigation.csproj | 20 ++ src/JsonEasyNavigation.sln | 22 -- .../ArrayEnumeratorWrapper.cs | 35 -- src/JsonEasyNavigation/BoxingSafeConverter.cs | 25 -- .../JsonEasyNavigation.csproj | 46 --- src/JsonEasyNavigation/JsonExtensions.cs | 113 ------ ...sonNavigationElement.ReadOnlyDictionary.cs | 133 ------- .../JsonNavigationElement.ReadOnlyList.cs | 109 ------ .../JsonNavigationElement.cs | 337 ------------------ .../ObjectEnumeratorWrapper.cs | 56 --- .../PrimitiveValueExtractor.cs | 108 ------ src/JsonEasyNavigation/PropertyPathVisitor.cs | 32 -- src/JsonEasyNavigation/Usings.cs | 1 - src/JsonExtensions.cs | 82 +++++ ...sonNavigationElement.ReadOnlyDictionary.cs | 96 +++++ src/JsonNavigationElement.ReadOnlyList.cs | 98 +++++ src/JsonNavigationElement.cs | 311 ++++++++++++++++ src/ObjectEnumeratorWrapper.cs | 51 +++ src/PrimitiveValueExtractor.cs | 107 ++++++ src/PropertyPathVisitor.cs | 27 ++ media/logo.png => src/Resources/project.png | Bin 56 files changed, 2656 insertions(+), 2675 deletions(-) create mode 100644 .github/FUNDING.yml create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/feature_request.md create mode 100644 .github/workflows/Test.yml create mode 100644 .github/workflows/delete_workflows.yml delete mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml create mode 100644 JsonEasyNavigation.sln delete mode 100644 LICENSE.txt create mode 100644 MIT-LICENSE.txt create mode 100644 Unit Tests/ArrayTests.cs create mode 100644 Unit Tests/CachedPropertiesTests.cs create mode 100644 Unit Tests/ExtensionsTests.cs create mode 100644 Unit Tests/JsonEasyNavigation.Tests.csproj create mode 100644 Unit Tests/MappingTests.cs create mode 100644 Unit Tests/NumberTests.cs create mode 100644 Unit Tests/PropertyTests.cs create mode 100644 Unit Tests/StablePropertyOrderAndCachedPropertiesTests.cs create mode 100644 Unit Tests/StablePropertyOrderTests.cs create mode 100644 Unit Tests/ValueKindsTests.cs delete mode 100644 media/logo.xcf create mode 100644 src/ArrayEnumeratorWrapper.cs create mode 100644 src/BoxingSafeConverter.cs delete mode 100644 src/JsonEasyNavigation.Tests/ArrayTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/CachedPropertiesTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/ExtensionsTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/JsonEasyNavigation.Tests.csproj delete mode 100644 src/JsonEasyNavigation.Tests/MappingTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/NumberTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/PropertyTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/StablePropertyOrderAndCachedPropertiesTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/StablePropertyOrderTests.cs delete mode 100644 src/JsonEasyNavigation.Tests/ValueKindsTests.cs create mode 100644 src/JsonEasyNavigation.csproj delete mode 100644 src/JsonEasyNavigation.sln delete mode 100644 src/JsonEasyNavigation/ArrayEnumeratorWrapper.cs delete mode 100644 src/JsonEasyNavigation/BoxingSafeConverter.cs delete mode 100644 src/JsonEasyNavigation/JsonEasyNavigation.csproj delete mode 100644 src/JsonEasyNavigation/JsonExtensions.cs delete mode 100644 src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyDictionary.cs delete mode 100644 src/JsonEasyNavigation/JsonNavigationElement.ReadOnlyList.cs delete mode 100644 src/JsonEasyNavigation/JsonNavigationElement.cs delete mode 100644 src/JsonEasyNavigation/ObjectEnumeratorWrapper.cs delete mode 100644 src/JsonEasyNavigation/PrimitiveValueExtractor.cs delete mode 100644 src/JsonEasyNavigation/PropertyPathVisitor.cs delete mode 100644 src/JsonEasyNavigation/Usings.cs create mode 100644 src/JsonExtensions.cs create mode 100644 src/JsonNavigationElement.ReadOnlyDictionary.cs create mode 100644 src/JsonNavigationElement.ReadOnlyList.cs create mode 100644 src/JsonNavigationElement.cs create mode 100644 src/ObjectEnumeratorWrapper.cs create mode 100644 src/PrimitiveValueExtractor.cs create mode 100644 src/PropertyPathVisitor.cs rename media/logo.png => src/Resources/project.png (100%) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..8876c8a --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1,14 @@ +# These are supported funding model platforms + +github: [Latency] +patreon: +open_collective: # Replace with a single Open Collective username +ko_fi: # Replace with a single Ko-fi username +tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel +community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry +liberapay: # Replace with a single Liberapay username +issuehunt: # Replace with a single IssueHunt username +lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry +polar: # Replace with a single Polar username +buy_me_a_coffee: latency +custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 0000000..dd84ea7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,38 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: '' +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Desktop (please complete the following information):** + - OS: [e.g. iOS] + - Browser [e.g. chrome, safari] + - Version [e.g. 22] + +**Smartphone (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Browser [e.g. stock browser, safari] + - Version [e.g. 22] + +**Additional context** +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md new file mode 100644 index 0000000..bbcbbe7 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature_request.md @@ -0,0 +1,20 @@ +--- +name: Feature request +about: Suggest an idea for this project +title: '' +labels: '' +assignees: '' + +--- + +**Is your feature request related to a problem? Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +**Describe the solution you'd like** +A clear and concise description of what you want to happen. + +**Describe alternatives you've considered** +A clear and concise description of any alternative solutions or features you've considered. + +**Additional context** +Add any other context or screenshots about the feature request here. diff --git a/.github/workflows/Test.yml b/.github/workflows/Test.yml new file mode 100644 index 0000000..7e8eda3 --- /dev/null +++ b/.github/workflows/Test.yml @@ -0,0 +1,54 @@ +name: Test + +on: + workflow_dispatch: + +jobs: + build: + runs-on: ${{ matrix.os }} + + strategy: + matrix: + os: [ubuntu-latest, self-hosted] + + steps: + + - name: Get BIN_DIR + id: bin-dir + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + bin_dir='${{ github.workspace }}/AssemblyLoader/bin/${{ matrix.BuildConfiguration }}' + elif [ "$RUNNER_OS" == "Windows" ]; then + bin_dir='${{ github.workspace }}\AssemblyLoader\bin\${{ matrix.BuildConfiguration }}' + else + echo "$RUNNER_OS not supported" + exit 1 + fi + echo "$bin_dir" + echo "BIN_DIR=$bin_dir" >> $GITHUB_ENV + + + - name: Get BRANCH_NAME + id: branch-name + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + split=(${GITHUB_REF_NAME//\// }) + elif [ "$RUNNER_OS" == "Windows" ]; then + split=(${GITHUB_REF_NAME////// }) + else + echo "$RUNNER_OS not supported" + exit 1 + fi + index=$((${#split[@]}-1)) + branch_name=${split[$index]} + echo "$branch_name" + echo "BRANCH_NAME=$branch_name" >> $GITHUB_ENV + + - name: Get Build Artifacts + if: false + shell: bash + run: | + mkdir -p Packages + curl -sS -O -L 'https://github.com/${{ github.repository_owner }}/Build-Configs/blob/master/{snKey.snk,Kitty.png}' diff --git a/.github/workflows/delete_workflows.yml b/.github/workflows/delete_workflows.yml new file mode 100644 index 0000000..f773e89 --- /dev/null +++ b/.github/workflows/delete_workflows.yml @@ -0,0 +1,76 @@ +name: Delete Workflow Runs +on: + workflow_dispatch: + inputs: + days: + description: 'Days-worth of runs to keep for each workflow' + required: true + default: '30' + minimum_runs: + description: 'Minimum runs to keep for each workflow' + required: true + default: '6' + delete_workflow_pattern: + description: 'Name or filename of the workflow (if not set, all workflows are targeted)' + required: false + delete_workflow_by_state_pattern: + description: 'Filter workflows by state: active, deleted, disabled_fork, disabled_inactivity, disabled_manually' + required: true + default: "ALL" + type: choice + options: + - "ALL" + - active + - deleted + - disabled_inactivity + - disabled_manually + delete_run_by_conclusion_pattern: + description: 'Remove runs based on conclusion: action_required, cancelled, failure, skipped, success' + required: true + default: "ALL" + type: choice + options: + - "ALL" + - "Unsuccessful: action_required,cancelled,failure,skipped" + - action_required + - cancelled + - failure + - skipped + - success + dry_run: + description: 'Dry Run' + default: false + type: boolean + required: false + +jobs: + del_runs: + runs-on: ubuntu-latest + permissions: + actions: write + contents: read + steps: + - name: Delete workflow runs + run: | + if [ ${{ github.event.inputs.dry_run }} = true ]; then + echo "DRY_RUN=${{ github.event.inputs.dry_run }}" >> $GITHUB_ENV + else + echo "DRY_RUN=" >> $GITHUB_ENV + fi + + - name: Delete workflow runs + uses: Mattraks/delete-workflow-runs@v2.0.6 + with: + token: ${{ github.token }} + repository: ${{ github.repository }} + retain_days: ${{ github.event.inputs.days }} + keep_minimum_runs: ${{ github.event.inputs.minimum_runs }} + delete_workflow_pattern: ${{ github.event.inputs.delete_workflow_pattern }} + delete_workflow_by_state_pattern: ${{ github.event.inputs.delete_workflow_by_state_pattern }} + delete_run_by_conclusion_pattern: >- + ${{ + startsWith(github.event.inputs.delete_run_by_conclusion_pattern, 'Unsuccessful:') + && 'action_required,cancelled,failure,skipped' + || github.event.inputs.delete_run_by_conclusion_pattern + }} + dry_run: ${{ env.DRY_RUN }} diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml index bf7ed94..44141ed 100644 --- a/.github/workflows/dotnet.yml +++ b/.github/workflows/dotnet.yml @@ -1,28 +1,56 @@ -name: .NET +name: .NET Core Desktop Build +env: + NUGET_SERVER_URL: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + NUGET_CONFIG: "../NuGet.config" + GH_TOKEN: ${{ secrets.LATENCY_PAT }} on: push: - branches: [ main ] + branches: master + pull_request: - branches: [ main ] -jobs: + workflow_dispatch: + +jobs: build: + if: ${{ startsWith(github.ref, 'refs/tags/') == false }} + runs-on: ${{ matrix.os }} - runs-on: ubuntu-latest - + strategy: + matrix: + os: [self-hosted] #, ubuntu-latest, windows-latest] + BuildConfiguration: [ Release ] + max-parallel: 2 + steps: - - uses: actions/checkout@v2 - - name: Setup .NET - uses: actions/setup-dotnet@v1 + + - name: Copy NuGet.Config Template + run: | + copy ../NuGet.Config.template ../NuGet.Config + + - name: Update NuGet Config + run: | + nuget config -Set defaultPushSource="${{ env.NUGET_SERVER_URL }}" -ConfigFile ${{ env.NUGET_CONFIG }} + dotnet nuget add source --username ${{ github.repository_owner }} --password ${{ secrets.NUGET_AUTH_TOKEN }} --protocol-version 3 --configfile ${{ env.NUGET_CONFIG }} --store-password-in-clear-text --name github "${{ env.NUGET_SERVER_URL }}" + + - uses: actions/checkout@v4.1.1 + with: + fetch-depth: '0' + + - uses: actions/setup-dotnet@v4.0.1 + if: matrix.os != 'self-hosted' with: - dotnet-version: 5.0.x + dotnet-version: '8.0.x' + dotnet-quality: 'signed' + source-url: ${{ env.NUGET_SERVER_URL }} + env: + NUGET_AUTH_TOKEN: ${{ secrets.NUGET_AUTH_TOKEN }} + - name: Restore dependencies run: dotnet restore - working-directory: src/ + - name: Build - run: dotnet build --no-restore - working-directory: src/ - - name: Test - run: dotnet test --no-build --verbosity normal - working-directory: src/ + id: build + run: | + dotnet build --no-restore --configuration ${{ matrix.BuildConfiguration }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 347f852..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,57 +0,0 @@ -name: Publish to nuget -on: - push: - branches: - - main # Default release branch - workflow_run: - workflows: [".NET"] - branches: [main] - types: - - completed - -jobs: - publish: - name: build, pack & publish - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - # - name: Setup dotnet - # uses: actions/setup-dotnet@v1 - # with: - # dotnet-version: 3.1.200 - - # Publish - - name: publish on version change - id: publish_nuget - uses: rohith/publish-nuget@v2 - with: - # Filepath of the project to be packaged, relative to root of repository - PROJECT_FILE_PATH: src/JsonEasyNavigation/JsonEasyNavigation.csproj - - # NuGet package id, used for version detection & defaults to project name - PACKAGE_NAME: JsonEasyNavigation - - # Filepath with version info, relative to root of repository & defaults to PROJECT_FILE_PATH - # VERSION_FILE_PATH: Directory.Build.props - - # Regex pattern to extract version info in a capturing group - VERSION_REGEX: ^\s*(.*)<\/Version>\s*$ - - # Useful with external providers like Nerdbank.GitVersioning, ignores VERSION_FILE_PATH & VERSION_REGEX - # VERSION_STATIC: 1.0.0 - - # Flag to toggle git tagging, enabled by default - # TAG_COMMIT: true - - # Format of the git tag, [*] gets replaced with actual version - TAG_FORMAT: v* - - # API key to authenticate with NuGet server - NUGET_KEY: ${{secrets.NUGET_API_KEY}} - - # NuGet server uri hosting the packages, defaults to https://api.nuget.org - # NUGET_SOURCE: https://api.nuget.org - - # Flag to toggle pushing symbols along with nuget package to the server, disabled by default - # INCLUDE_SYMBOLS: false diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b9a5007 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,157 @@ +name: .NET Core Desktop Release +env: + NUGET_SERVER_URL: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + GH_TOKEN: ${{ secrets.LATENCY_PAT }} + +on: + push: + tags: 'v[0-9]+.[0-9]+.[0-9]+' + + workflow_dispatch: + +jobs: + pre_job: + runs-on: ubuntu-latest + outputs: + should_skip: ${{ steps.skip_check.outputs.should_skip }} + steps: + - id: skip_check + uses: fkirc/skip-duplicate-actions@v5.3.1 + with: + skip_after_successful_duplicate: 'true' + + release: + needs: pre_job + if: ${{ needs.pre_job.outputs.should_skip != 'true' }} + runs-on: ${{ matrix.os }} + + permissions: + packages: write + contents: write # write permission is required to create a github release + pull-requests: write # write permission is required for autolabeler otherwise, read permission is required at least + + strategy: + matrix: + os: [self-hosted] #, ubuntu-latest, windows-latest] + BuildConfiguration: [ Release ] + max-parallel: 2 + + steps: + + - name: Get PROJECT_NAME + id: project-name + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + split=(${GITHUB_REPOSITORY//\// }) + elif [ "$RUNNER_OS" == "Windows" ]; then + split=(${GITHUB_REPOSITORY////// }) + else + echo "$RUNNER_OS not supported" + exit 1 + fi + index=$((${#split[@]}-1)) + project_tag=${split[$index]} + echo "$project_tag" + echo "PROJECT_NAME=$project_tag" >> $GITHUB_ENV + + - name: Get README.md Description & PACKAGE_VERSION + id: readme-desc + shell: bash + run: | + if [ "$RUNNER_OS" == "Linux" ]; then + filenames=$(ls ${{ github.workspace }}) + elif [ "$RUNNER_OS" == "Windows" ]; then + filenames=$(ls ${GITHUB_WORKSPACE//\//\\ }) + else + echo "$RUNNER_OS not supported" + exit 1 + fi + for filename in ${filenames[@]}; do + if [ -f $filename -a "$filename" = "README.md" ]; then + desc=$(sed -n '2{P;q;}' $filename | sed 's/\n$//' | sed 's/\r$//' | cut -c 5- ) + echo "$desc" + echo "README_DESC=$desc" >> $GITHUB_ENV + + regex="(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(\\-[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?(\\+[0-9A-Za-z-]+(\\.[0-9A-Za-z-]+)*)?" + if [[ $(grep '