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

new(workflows/push): automate releases #1073

Merged
merged 5 commits into from
Mar 8, 2021
Merged

Conversation

williaster
Copy link
Collaborator

@williaster williaster commented Feb 18, 2021

🏠 Internal

This PR adds automated releases to the github push workflow (i.e., merges into master). I wrote most everything custom because I couldn't find anything compelling for both the automated release + changelog updates without also adopting conventional commits which I think would be tricky. Npm auth with lerna was tricky 🥴 .

In the future the release cycle would work like the following:

  • if a PR is merged without a release label (patch-release, minor-release, major-release, alpha-release), nothing will happen
  • if a PR is merged with a release label, a release will be triggered
  • a release includes the following:
    • git tags + npm packages are published using lerna (same as now) with a version tag (patch, minor, major, ±alpha) that matches any PR release labels found since the last release
    • for non-alpha releases, the changelog is updated using all PRs found since the last release:
      • PR titles are used for changelog entries, with a link to the PR
      • changelog categorization is done using PR labels (bug, enhancement, internal, docs, breaking). if the PR has multiple labels, it will be listed in multiple categories in the changelog
      • contributors are listed
    • after the release (including alpha releases), the github-bot posts on all PRs since the last release informing the author(s) which version the PR was released as

I tested this as much as I could on a branch, so hopefully it will go smootly upon merge.

Example commits

Example changelog diff

Example posting on PRs

@kristw @hshoff

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 Hi,
This is a reminder for maintainers to assign a proper release label to this Pull Request.
The bot will dismiss the review as soon as a valid release label has been assigned.
Thanks.

@github-actions github-actions bot dismissed their stale review February 18, 2021 20:13

✅ Pull Request has a valid release label.

@williaster williaster force-pushed the chris--actions-prlabels branch 25 times, most recently from 65e23e3 to 683e180 Compare March 1, 2021 03:42
@williaster williaster changed the title WIP: automate releases new(workflows/push): automate releases Mar 1, 2021
// perform release
try {
const version = `${isPreRelease ? 'pre' : ''}${
isMajor ? 'major' : isMinor ? 'minor' : 'patch'
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if only alpha-release is set, this will default to patch which I think is safe

run: |
yarn build:sizes
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "build(${GITHUB_SHA}): auto-commit package sizes"
git diff-index --quiet HEAD || git commit -m "build(${GITHUB_SHA}): auto-commit package sizes"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if there were no package size changes, this was failing before

Copy link
Collaborator

@kristw kristw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks for all the research. A lot of customization here.

@williaster williaster merged commit 58de6cb into master Mar 8, 2021
@williaster williaster deleted the chris--actions-prlabels branch March 8, 2021 20:03
@github-actions
Copy link

github-actions bot commented Mar 8, 2021

🎉 This PR is included in version v1.6.1 of the packages modified 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants