Skip to content
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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mcous
Copy link
Collaborator

@mcous mcous commented Apr 30, 2024

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

  • Add semantic-release to dev dependencies
  • Update release step in CI workflow to simply call semantic-release
  • Add release:preview script for maintainers to locally preview a release on a branch

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:

  • Must have push access to the repository
  • Branch must exist on the remote

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
Copy link
Collaborator Author

mcous commented Apr 30, 2024

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 mcous force-pushed the semantic-release-dry-run branch from 8fc1b2d to a4cafa5 Compare May 1, 2024 05:13
@mcous mcous changed the title ci(release): configure semantic release plugin in dry-run mode ci(release): use semantic-release directly, add release preview script May 1, 2024
@mcous mcous requested a review from yanick May 1, 2024 05:30
@mcous
Copy link
Collaborator Author

mcous commented May 11, 2024

@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 mcous marked this pull request as ready for review May 11, 2024 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Investigate seeing the next version before the deploy
1 participant