diff --git a/.github/release.yml b/.github/release.yml new file mode 100644 index 00000000..7407cbe9 --- /dev/null +++ b/.github/release.yml @@ -0,0 +1,21 @@ +changelog: + categories: + - title: Breaking Changes + labels: + - breaking-change + - title: Features + labels: + - enhancement + - feature + - title: Fixes + labels: + - bug + - bugfix + - title: Maintenance + labels: + - chore + - dependencies + - documentation + exclude: + labels: + - skip-changelog diff --git a/.github/workflows/publish-nuget.yml b/.github/workflows/publish-nuget.yml index 4753fb76..001f20ec 100644 --- a/.github/workflows/publish-nuget.yml +++ b/.github/workflows/publish-nuget.yml @@ -1,30 +1,43 @@ -# This is a basic workflow to help you get started with Actions +name: Release -name: Build & Publish to NuGet - -# Controls when the action will run. on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: + release: + types: + - published + +permissions: + contents: read -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - build: - # The type of runner that the job will run on + publish-nuget: runs-on: ubuntu-latest + env: + solution: WordPressPCL.sln + project: WordPressPCL/WordPressPCL.csproj + release_tag: ${{ github.event.release.tag_name }} - # Steps represent a sequence of tasks that will be executed as part of the job steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v5 + with: + fetch-depth: 0 - name: Setup .NET SDK uses: actions/setup-dotnet@v5 with: dotnet-version: 10.x - - name: Build & Package + - name: Validate release tag + id: version run: | - cd WordPressPCL - dotnet pack -c Release -o out - - name: PushNuget - run: dotnet nuget push "**/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{secrets.WORDPRESSPCLNUGET}} --skip-duplicate + version="${release_tag#v}" + if [[ ! "$release_tag" =~ ^v[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?$ ]]; then + echo "Release tag '$release_tag' must use the format v..[-suffix]." + exit 1 + fi + echo "value=$version" >> "$GITHUB_OUTPUT" + - name: Restore + run: dotnet restore ${{ env.solution }} --disable-parallel + - name: Build + run: dotnet build ${{ env.solution }} -c Release --no-restore -p:Version=${{ steps.version.outputs.value }} + - name: Pack + run: dotnet pack ${{ env.project }} -c Release --no-build -o artifacts -p:Version=${{ steps.version.outputs.value }} + - name: Publish to NuGet + run: dotnet nuget push "artifacts/*.nupkg" --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.WORDPRESSPCLNUGET }} --skip-duplicate diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 00000000..f1087216 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,251 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The project now uses GitHub Releases as the source of truth for versioned release notes. Create releases with tags like `v3.0.1` or `v3.1.0-rc.1` and keep this changelog in sync with the published release. + +## [Unreleased] + +### Changed + +- Placeholder for upcoming changes before the next GitHub release is published. + +## [3.0.0] + +### Changed + +- Target .NET 10. +- Dropped previous .NET Standard and .NET 6 test targets. + +## [2.1.0] + +### Changed + +- Upgraded dependencies. +- Fixed `GetCurrentUserAsync()` naming. +- Allowed `HttpClient` injection without a base address. +- Added optional `ignoreDefaultPath` on `CustomRequest` methods. + +## [2.0.2] + +### Added + +- Support for plugins. +- Support for statuses in `UsersQueryBuilder`. + +### Changed + +- Upgraded `Newtonsoft.Json` to 13.0.3. + +## [2.0.1] + +### Changed + +- Upgraded `Newtonsoft.Json` to 13.0.1. + +## [2.0.0] + +### Added + +- `WordPressClient` accepts the endpoint as a `Uri`. +- Support for getting the total post count without fetching the posts. +- Generic JWT and Basic Auth support. + +### Changed + +- Dropped `netstandard1.x` support. +- Added the `Async` suffix to all public async methods. +- Moved auth-related functionality to the auth sub-client. +- Moved settings functionality to the settings sub-client. + +### Fixed + +- Improved error handling for `WP_DEBUG_DISPLAY`. + +## [1.9.0] + +### Added + +- Support for application passwords. + +### Changed + +- Raised the minimum target from `netstandard1.1` to `netstandard1.3`. + +## [1.8.5] + +### Fixed + +- Query builder now appends default enum values to the query string for easier debugging. + +## [1.8.4] + +### Fixed + +- `HttpClient` injection. + +## [1.8.2] + +### Added + +- Support for the JWT Auth plugin. + +## [1.7.2] + +### Added + +- Support for posts trash status. +- Support for providing an `HttpClient` to `WordPressClient`. + +## [1.7.1] + +### Added + +- Package icon. + +### Changed + +- Updated the license expression. + +## [1.7.0] + +### Added + +- Optional MIME type override for media upload. + +### Changed + +- Improved handling of `HttpClient` headers. +- Downgraded JSON.NET to 11.0.1. +- Refactored exceptions. + +## [1.6.2] + +### Added + +- `.kmz` and `.kml` MIME types (#162). + +### Fixed + +- Cleaned up the file stream after upload (#166). + +## [1.6.1] + +### Fixed + +- `Capabilities` can now contain strings instead of only booleans (#147). + +## [1.6.0-beta1] + +### Changed + +- Marked all `Meta` properties as dynamic because the structure can be volatile. + +## [1.5.1] + +### Fixed + +- `MediaSizes` height and width are now optional (#143). + +## [1.5.0] + +### Fixed + +- Enhanced error handling. +- Addressed issue [#138](https://github.com/wp-net/WordPressPCL/issues/138). + +## [1.4.6] + +### Fixed + +- Added `DefaultValueHandling` to the comment status property. + +## [1.4.5] + +### Fixed + +- Added `NullValueHandling` to `FeaturedMedia`. + +## [1.4.4] + +### Added + +- Yoast taxonomy terms. + +## [1.4.3] + +### Fixed + +- Added default serializer settings with `MissingMemberHandling.Ignore`. + +## [1.4.2] + +### Fixed + +- Delete requests now return `bool` instead of `HttpResponseMessage`. + +## [1.4.1-alpha] + +### Added + +- Experimental WordPress.com support (read-only). +- Experimental descending threaded comments support. + +## [1.4.0] + +### Changed + +- Made `HttpClient` static. + +### Fixed + +- Exceptions are now thrown instead of being hidden. +- Stopped auto-appending `/wp-json` to the WordPress URI. + +## [1.3.3] + +### Fixed + +- Updating `Comment.Status`. + +## [1.3.2] + +### Fixed + +- `Comment.Status` handling. + +## [1.3.1] + +### Added + +- `maxDepth` option for threaded comments. + +## [1.3.0] + +### Added + +- `ToThreaded` method for transforming comments. +- `.NET Standard 2.0` support. +- Uploading media directly from a file path (`.NET Standard 2.0` only). + +### Changed + +- Passed deserialization settings into `HttpHelper`. + +## [1.2.1] + +### Added + +- JWT getter and setter methods. + +## [1.2.0] + +### Added + +- Helper method to sort comments for a threaded view. +- Method to get all comments for a post id. +- Logout method. + +### Fixed + +- Improved async performance in several code paths. diff --git a/README.md b/README.md index adafcbb5..2ddbd21f 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,14 @@ The WordPressPCL API Wrapper is avaiable through [NuGet](https://www.nuget.org/p > Install-Package WordPressPCL ``` +## Release Process + +WordPressPCL uses GitHub Releases as the source of truth for publishing new package versions. + +1. Update [CHANGELOG.md](CHANGELOG.md) with the release highlights. +2. Create a GitHub release with a `vX.Y.Z` tag (or `vX.Y.Z-suffix` for pre-releases) and GitHub-generated release notes. +3. Publishing that release triggers the NuGet workflow, which builds and publishes the same version to NuGet. + ## Runtime Requirement WordPressPCL 3.0 targets .NET 10 only. Upgrading from 2.x is a breaking change and requires applications and test environments to move to the .NET 10 SDK/runtime before restoring, building, or running tests. diff --git a/WordPressPCL/WordPressPCL.csproj b/WordPressPCL/WordPressPCL.csproj index a42944b3..44b255c0 100644 --- a/WordPressPCL/WordPressPCL.csproj +++ b/WordPressPCL/WordPressPCL.csproj @@ -12,130 +12,9 @@ https://github.com/wp-net/WordPressPCL WordPress REST API GitHub - 3.0.0.0 - 3.0.0.0 - 3.0.0 + 3.0.0 - V3.0.0 -- Target .NET 10 -- Dropped previous .NET Standard and .NET 6 test targets - -V2.1.0 -- Upgraded dependencies -- Fix GetCurrentUserAsync() naming -- Allow httpclient injection without base address -- Added optional ignoreDefaultPath on CustomRequest methods - -V2.0.2 -- Support for Plugins -- Support for Statuses in UsersQueryBuilder -- Upgraded Newtonsoft.Json dependency to 13.0.3 - -V2.0.1 -- Upgraded Newtonsoft.Json dependency to 13.0.1 - -V2.0.0 -- Dropped netstandard1.x support -- Added Async-Suffix for all public async methods -- Moved Auth-related functionality to Auth-Sub-Client -- Error handling for WP_DEBUG_DISPLAY -- Moved Settings functionality to Settings-Sub-Client -New Features: -- WordPressClient accepts endpoint also as Uri -- Get total Post count without the actual posts -- Generic JWT and Basic Auth support - -V1.9.0 -- Support for Application Passwords -- Upped netstandard1.1 to netstandard1.3 - -V1.8.5 -- Bugfix for Query Builder, will now append default enum values to query string for easier debugging - -V1.8.4 -- Bugfix for HttpClient injection - -V1.8.2 -- Support for JWT Auth Plugin - -V1.7.2 -- Added support for posts trash status -- Added support for providing httpclient to WordPressClient - -V1.7.1 -- Added Icon -- Updated License Expression - -V1.7.0 -- Added optional MIME-Type override for Media upload -- Improved handling of HttpClient headers -- Downgraded JSON.NET dependency to V11.0.1 -- Exceptions Refactoring - -V1.6.2 -- Clean up file stream after upload #166 -- Added .kmz & .kml Mime Types #162 - -V1.6.1 -- Fix for #147 where Capabilities might contain strings instead of bool - -V1.6.0-beta1 -- marking all Meta properties as dynamic as the structure seems to be very volatile - -V1.5.1 -- Make height & width optional in MediaSizes (#143) - -V1.5.0 -- Enhanced Error handling -https://github.com/wp-net/WordPressPCL/issues/138 - -V1.4.6 -- Bugfix: Add DefaultValueHandling to Comment Status property - -V1.4.5 -- Bugfix: Add NullValueHandling to FeaturedMedia property - -V1.4.4 -- Add Yoast Taxonomy Terms - -V1.4.3 -- Bugfix: Add default JsonSerzializerSettings, setting MissingMemberHandling to ignore - -V1.4.2 -- Bugfix: delete requests return bool instead of HTTPResponseMessage - -V1.4.1-alpha -- Experimental WordPress.com support (readonly) -- Experimental Descending Threaded Comments support - -V1.4.0 -- making HttpClient static -- Exceptions will be thrown instead of hiding them -- don't auto-append /wp-json to WordPress Uri - -V1.3.3 -- Fixing update of Comment.Status - -V1.3.2 -- Fixing Comment.Status issue - -V1.3.1 -- added maxDepth option for threaded comments - -V1.3.0 -- added ToThreaded-method for transforming comments -- pass deserialization settings into HttpHelper class -- Added .netstandard 2.0 support -- upload media directly from file path (.netstandard 2.0 only) - -V1.2.1 -- added JWT getter & setter methods - -V1.2 -- added helper method to sort comments for a threaded view -- added method to get all comments for a post id -- fixed some async issues for better performance -- added logout method + See CHANGELOG.md and https://github.com/wp-net/WordPressPCL/releases © Thomas Pentenrieder | 2023 library @@ -158,6 +37,10 @@ V1.2 True \ + + True + \ + True