diff --git a/.changeset/nyrdfxvizwsykar.md b/.changeset/nyrdfxvizwsykar.md new file mode 100644 index 0000000..1a33ed6 --- /dev/null +++ b/.changeset/nyrdfxvizwsykar.md @@ -0,0 +1,5 @@ +--- +"SolarWinds.Changesets": Patch +--- + +[[#28](https://github.com/solarwinds/net-changesets/issues/28)] Added documentation for integrating net-changesets with the official Changesets GitHub Action, including custom `version` and `publish` commands, required checkout depth, status-check behavior, NuGet source configuration, and links to a working demo workflow. ([PR #29](https://github.com/solarwinds/net-changesets/pull/29)) diff --git a/README.md b/README.md index 49573e9..7291da7 100644 --- a/README.md +++ b/README.md @@ -34,6 +34,35 @@ This .NET implementation is port from original `npm` implementation [@changesets - `publish` This publishes changes to specified nuget repository - `status` Provides information about the changesets that currently exist. If there are no changesets present, it exits with an error status code +## Changesets GitHub Action Integration with the .NET Changesets Implementation + +net-changesets can be used together with the original [changesets GitHub action](https://github.com/changesets/action). The action supports custom commands for the versioning and publishing steps, so a net-changesets tool can be used instead of the default [JavaScript-based changesets CLI tool](https://github.com/changesets/changesets). + +After each merge to the main branch, the action creates a release PR. During that step, `changeset version` converts changeset files into changelog entries and bumps C# project versions. When the release PR is merged, `changeset publish` builds and publishes NuGet packages to the configured nuget source. + +Minimal action configuration: + +```yaml +- name: Create release pull request or publish packages + uses: changesets/action@v1 + with: + version: changeset version + publish: changeset publish +``` +Just a note: we don't need to override changesets status, because both the .NET and Node.js implementations use the same behavior for this command. + +Important workflow details: + +- Checkout should use `fetch-depth: 2`, because `changeset publish` compares the last two commits to find changed packages. +- If the workflow runs `changeset status`, use `continue-on-error: true` when an empty changeset state should not fail the job. +- The publish target is controlled by the net-changesets configuration and NuGet configuration. The demo publishes to a local folder package source configured in [.changeset/config.json](https://github.com/magiino/Marekth.NetChangesets.Demo/blob/main/.changeset/config.json#L3) and [nuget.config](https://github.com/magiino/Marekth.NetChangesets.Demo/blob/main/nuget.config). + +For a complete working example, see the [net-changesets demo repository](https://github.com/magiino/Marekth.NetChangesets.Demo/tree/main), especially the configured [release workflow](https://github.com/magiino/Marekth.NetChangesets.Demo/blob/main/.github/workflows/release.yml). The workflow wires the changesets action to net-changesets through its custom command inputs, as shown around [line 44](https://github.com/magiino/Marekth.NetChangesets.Demo/blob/main/.github/workflows/release.yml#L44). It also shows the required checkout depth at [line 16](https://github.com/magiino/Marekth.NetChangesets.Demo/blob/main/.github/workflows/release.yml#L16) and a non-failing status check at [line 48](https://github.com/magiino/Marekth.NetChangesets.Demo/blob/main/.github/workflows/release.yml#L48). An example generated release PR is available at [magiino/Marekth.NetChangesets.Demo#7](https://github.com/magiino/Marekth.NetChangesets.Demo/pull/7), and the repository [commit history](https://github.com/magiino/Marekth.NetChangesets.Demo/commits/main/) shows the release flow in detail. + +**You can fork the demo repository and try the workflow yourself !!! :)** + +The changesets action can also customize the release PR title, description, commit message, and other behavior. See the action [inputs documentation](https://github.com/changesets/action?tab=readme-ov-file#inputs) for the full list of supported options. + ## Documentation - [Implementation Details of net-changesets commands](https://github.com/solarwinds/net-changesets/blob/main/docs/commands-implementation-details.md)