-
Notifications
You must be signed in to change notification settings - Fork 0
Automate releases with Release Please #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
01e2fad
a409588
877eff1
af6120e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| name: Release Please | ||
|
|
||
| # On every push to main, Release Please reads conventional commits (feat:, fix:, feat!: ...) | ||
| # and keeps a release PR open that bumps <Version> in Directory.Build.props and CHANGELOG.md. | ||
| # Merging that PR creates a *draft* GitHub release; release.yml then builds, tests, runs the | ||
| # W3C gate, publishes to NuGet, and only then publishes the release (which creates the tag). | ||
| # So a failed publish never leaves a public release or tag behind. | ||
| # | ||
| # Optional: set a RELEASE_PLEASE_TOKEN secret (fine-grained PAT, contents + pull-requests | ||
| # write) so the release PR is opened as a user and CI runs on it. With the default | ||
| # GITHUB_TOKEN, PRs opened by Actions do not trigger pull_request workflows; release.yml | ||
| # re-runs the full suite before publishing, so this is a convenience, not a gate. | ||
| on: | ||
| push: | ||
| branches: [main] | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| release-please: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| release_created: ${{ steps.rp.outputs.release_created }} | ||
| tag_name: ${{ steps.rp.outputs.tag_name }} | ||
| sha: ${{ steps.rp.outputs.sha }} | ||
| steps: | ||
| - uses: googleapis/release-please-action@v4 | ||
| id: rp | ||
|
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 877eff1. |
||
| with: | ||
| token: ${{ secrets.RELEASE_PLEASE_TOKEN || secrets.GITHUB_TOKEN }} | ||
|
|
||
| # A tag created with GITHUB_TOKEN does not fire `on: push: tags`, so call the release | ||
| # workflow directly instead of relying on the tag trigger. | ||
| publish: | ||
| needs: release-please | ||
| if: ${{ needs.release-please.outputs.release_created == 'true' }} | ||
| uses: ./.github/workflows/release.yml | ||
| with: | ||
| tag: ${{ needs.release-please.outputs.tag_name }} | ||
| sha: ${{ needs.release-please.outputs.sha }} | ||
| secrets: inherit | ||
|
Comment on lines
+36
to
+43
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Addressed in 877eff1. Release Please now creates a draft release ( |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| { | ||
| ".": "0.1.0-alpha" | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| # Contributing | ||
|
|
||
| ## Build and test | ||
|
|
||
| Requires the .NET 10 SDK (pinned in `global.json`). | ||
|
|
||
| ```bash | ||
| dotnet build XState.slnx | ||
| dotnet test XState.slnx | ||
| ``` | ||
|
|
||
| CI runs the same on every PR and push to `main`. The W3C SCXML suite must match | ||
| [CONFORMANCE.md](CONFORMANCE.md) exactly: an unexpected pass fails the run, same as an | ||
| unexpected failure. Update the `KnownFailing` list and CONFORMANCE.md together. | ||
|
|
||
| ## Commit messages | ||
|
|
||
| Use [Conventional Commits](https://www.conventionalcommits.org/). Release Please reads | ||
| them to pick the next version and write the changelog: | ||
|
|
||
| | Prefix | Effect | | ||
| |---|---| | ||
| | `fix:` | patch bump, listed under Bug Fixes | | ||
| | `feat:` | minor bump, listed under Features | | ||
| | `feat!:` or `BREAKING CHANGE:` footer | major bump (while pre-1.0: minor) | | ||
| | `chore:`, `docs:`, `ci:`, `test:`, `refactor:` | no release, not in changelog | | ||
|
|
||
| Squash-merge PRs and make the squash title the conventional commit. | ||
|
|
||
| ## Releasing | ||
|
|
||
| Releases are automated. Do not edit `<Version>` in `Directory.Build.props` or | ||
| `CHANGELOG.md` by hand. | ||
|
|
||
| 1. Merge PRs to `main` as usual. | ||
| 2. Release Please keeps a PR open titled `chore(main): release <version>`. It bumps | ||
| `<Version>` and updates `CHANGELOG.md`. Review the changelog there. | ||
| 3. Merge that PR. This creates a draft GitHub release and runs `release.yml`, which builds, | ||
| tests, runs the W3C gate, packs, and pushes `XState` and `XState.Scxml` to nuget.org. | ||
| 4. On success the workflow publishes the release, which creates the `v<version>` tag. | ||
| On failure nothing is public: fix on `main`, then re-run the failed workflow. | ||
|
|
||
| ### Versioning | ||
|
|
||
| Pre-1.0: `feat:` bumps minor, `fix:` bumps patch. Versions are alpha prereleases | ||
| (`0.1.0-alpha`, ...). To go stable, remove `prerelease`, `prerelease-type`, and | ||
| `versioning` from `release-please-config.json`. | ||
|
|
||
| ### Publishing credentials | ||
|
|
||
| NuGet uses Trusted Publishing (OIDC): nuget.org holds a policy for | ||
| `statelyai/xstate-csharp` + `release.yml`, packages `XState*`, owner `davidkpiano`. | ||
| No API key secret exists. `NuGet/login@v1` exchanges the workflow's OIDC token for a | ||
| short-lived key. Manage the policy at https://www.nuget.org/account/trustedpublishing. | ||
|
|
||
| Optional: a `RELEASE_PLEASE_TOKEN` repo secret (fine-grained PAT with contents and | ||
| pull-requests write) makes the release PR open as a user so CI runs on it. Without it the | ||
| PR still works; `release.yml` runs the full suite before publishing regardless. | ||
|
|
||
| ### Manual release | ||
|
|
||
| Pushing a `v<Version>` tag matching `Directory.Build.props` also runs `release.yml`. | ||
| Use only if the automation is broken. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| { | ||
| "$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json", | ||
| "release-type": "simple", | ||
| "draft": true, | ||
| "include-component-in-tag": false, | ||
| "bump-minor-pre-major": true, | ||
| "bump-patch-for-minor-pre-major": true, | ||
| "prerelease": true, | ||
| "prerelease-type": "alpha", | ||
| "versioning": "prerelease", | ||
| "packages": { | ||
| ".": { | ||
| "package-name": "xstate", | ||
| "changelog-path": "CHANGELOG.md", | ||
| "extra-files": [ | ||
| { "type": "xml", "path": "Directory.Build.props", "xpath": "//Version" } | ||
| ] | ||
| } | ||
| } | ||
| } |
Uh oh!
There was an error while loading. Please reload this page.