ezyang / htmlpurifier

Standards compliant HTML filter written in PHP
http://htmlpurifier.org
GNU Lesser General Public License v2.1
3.07k stars 327 forks source link

feat: add semantic release #307

Closed bytestream closed 2 years ago

bytestream commented 2 years ago

Requires a GitHub auth token adding to the repository secrets of name GITHUB_TOKEN https://docs.github.com/en/actions/security-guides/encrypted-secrets

How does it work? https://semantic-release.gitbook.io/semantic-release/#how-does-it-work

Release notes / change log is generated based on fix: / feat: commit messages. So the first automatic release won't include historic commits which don't match that format.

Closes #304

ezyang commented 2 years ago

So the first automatic release won't include historic commits which don't match that format.

Should do a normal release then before turning this on.

ezyang commented 2 years ago

Will need to setup commitizen/commitlint before landing this to ensure commit messages are valid

ezyang commented 2 years ago

Wondering if we actually want a release every time a PR is merged. Might be better to offer a stable branch (periodic release) and a dev branch (tracking master)

bytestream commented 2 years ago

Should do a normal release then before turning this on.

Yeah. I can send a PR with the file updates for the release if you want?

Will need to setup commitizen/commitlint

There's a few GitHub actions that handle stuff like this. I prefer to enforce squashing and lint the PR title. Thoughts - lint PR title, or all commits?

Might be better to offer a stable branch (periodic release) and a dev branch (tracking master)

Releasing after every PR seems to be common in JS libraries. It's up to you, but a periodic release would probably require manual action again

ezyang commented 2 years ago

Yeah. I can send a PR with the file updates for the release if you want?

I just cut 4.14.0 so I think we're clear here.

There's a few GitHub actions that handle stuff like this. I prefer to enforce squashing and lint the PR title. Thoughts - lint PR title, or all commits?

I set the repo to squash by default so we just have to lint PR title.

Releasing after every PR seems to be common in JS libraries. It's up to you, but a periodic release would probably require manual action again

OK, maybe this is me not understanding semantic release, but what's the point of releases if you release every PR. That seems like what a nightly is for.

bytestream commented 2 years ago

I set the repo to squash by default so we just have to lint PR title.

I'll look at adding a GitHub Action which lints the PR title.

OK, maybe this is me not understanding semantic release, but what's the point of releases if you release every PR. That seems like what a nightly is for.

It wouldn't necessarily be a point release - feat: for minor release, and fix: for patch release.

I think the only real benefit to releasing after every PR is that it's fully automated. The other benefit is that easy to rollback to a previously working version if one PR breaks something.

Might be better to offer a stable branch (periodic release) and a dev branch (tracking master)

This should be do-able, but would require you to manually merge dev into stable to trigger a release. I'm not sure there's any specific benefit to that flow.

We could perhaps just make semantic-release a manual GitHub Action that only runs on the master branch?

ezyang commented 2 years ago

I'm down to try with a manual GitHub action to start, and then upgrade into continuous if we like it.

bytestream commented 2 years ago

I've updated it so the PR title is linted, and it runs manually.

Two things to note, but I don't think you need to worry about either:

To manually run the action see https://docs.github.com/en/actions/managing-workflow-runs/manually-running-a-workflow

ezyang commented 2 years ago

I plan to merge this after the upcoming release, then do a "stutter" relase to check that this is working

github-actions[bot] commented 2 years ago

:tada: This PR is included in version 4.16.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: