testing-library / svelte-testing-library

:chipmunk: Simple and complete Svelte DOM testing utilities that encourage good testing practices
https://testing-library.com/docs/svelte-testing-library/intro
MIT License
608 stars 34 forks source link

ci(release): use semantic-release directly, add release preview script #373

Closed mcous closed 3 weeks ago

mcous commented 2 months ago

Overview

This PR updates the release configuration to use semantic-release directly rather than misdirect through a 3rd-party GitHub Action. By using semantic-release directly, we also gain the opportunity to do "dry run" releases locally.

Closes #356 (maybe?)

Change log

Release preview

I originally set out to get a "release preview" to be a part of the CI workflow. I ran into the following roadblocks with semantic-release:

I threw myself at it a couple times, and walked away thinking that this just isn't something semantic-release is designed to do. So, I settled for something a little more crude that can hopefully still be helpful for maintainers - a local script:

npm run release:preview

Wen I run this on this branch, I get:

> @testing-library/svelte@0.0.0-semantically-released release:preview
> ./scripts/preview-release

++ git rev-parse --abbrev-ref HEAD
+ branch=semantic-release-dry-run
++ git remote get-url origin
+ repository_url=git@github.com:testing-library/svelte-testing-library.git
+ semantic-release --plugins=@semantic-release/commit-analyzer,@semantic-release/release-notes-generator --dry-run --branches=semantic-release-dry-run --repository-url=git@github.com:testing-library/svelte-testing-library.git
[1:22:57 AM] [semantic-release] › ℹ  Running semantic-release version 23.0.8
[1:22:57 AM] [semantic-release] › ✔  Loaded plugin "analyzeCommits" from "@semantic-release/commit-analyzer"
[1:22:57 AM] [semantic-release] › ✔  Loaded plugin "generateNotes" from "@semantic-release/release-notes-generator"
[1:23:06 AM] [semantic-release] › ⚠  Run automated release from branch semantic-release-dry-run on repository git@github.com:testing-library/svelte-testing-library.git in dry-run mode
[1:23:07 AM] [semantic-release] › ✔  Allowed to push to the Git repository
[1:23:07 AM] [semantic-release] › ℹ  Found git tag v5.1.0 associated with version 5.1.0 on branch semantic-release-dry-run
[1:23:08 AM] [semantic-release] › ℹ  Found 4 commits since last release
[1:23:08 AM] [semantic-release] › ℹ  Start step "analyzeCommits" of plugin "@semantic-release/commit-analyzer"
[1:23:08 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  Analyzing commit: ci(release): use `semantic-release` directly, add release preview script

Closes #356
[1:23:08 AM] [semantic-release] [@semantic-release/commit-analyzer] › ℹ  The commit should not trigger a release
# ...more commits omitted to keep this PR description short...
[1:23:08 AM] [semantic-release] › ℹ  There are no relevant changes, so no new version is released.
mcous commented 2 months ago

Comment no longer relevant; see PR desription


~Oof, this one is rough; semantic-release really doesn't have a good, out of the box way to simply get the expected bump and release notes from a PR without doing any of the other semantic release stuff~

~This is a really common problem in the community it seems, so there's a lot of work floating around to try to solve it. I'll evaluate potential solutions and come back to this~

mcous commented 1 month ago

@yanick I was also curious about your thoughts on this one. I'm walking away pretty annoyed with semantic-release as a tool, but this PR I think is at least a little helpful, and unblocks #354 by adding release.config.js

mcous commented 1 month ago

I don’t think this PR as written is worth the risk. I think it should be pared down to just the config file changes so that #354 can be addressed, but I don’t see a great path forward with #356