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

Release improvements #640

Draft
wants to merge 82 commits into
base: main
Choose a base branch
from

Conversation

rgoldberg
Copy link
Contributor

@rgoldberg rgoldberg commented Nov 16, 2024

@phatblat
This is my WIP of improvements for the release process, plus some unrelated cleanup.

I haven't tested any of this stuff, as I'm worried about accidentally releasing a new version.

I've incorporated all your changes from your 638/release-fixes, so that can be deleted.

Can you start looking through the changes, then let me know if they're good, should be changed, or should be discarded?

The general principle of this PR is simplicity:

  • Remove extraneous files from mas-cli/mas repo:
    • Makefile
    • Many bash scripts
    • Homebrew formulae: store each only in its respective tap repo, e.g., homebrew/homebrew-core or mas-cli/tap
      • Bump homebrew-core & mas-cli/tap/mas formulae in taps instead of locally generating / modifying them.
        • Do not create a manual pull request for the custom tap.
    • Generate files only when absolutely necessary, but git ignore them, e.g., Sources/mas/Package.swift
  • Do not commit or branch in mas-cli/mas on release.
  • Store values in as few places as possible, e.g.:
    • Store version in mas-cli/mas repo only in version tag, not in any files or in any branch names
  • Reuse existing functionality (like brew bump-formula-pr) instead of reinventing the wheel
  • Standardize:
    • Ensure the same tools are used everywhere, e.g.:
      • ensure /bin/bash is used everywhere instead of some places using bash from the $PATH
    • Remove dependencies whose functionality can be performed by other things, e.g.:
      • sd (script that used it was deleted, but if script kept, should use bash scripting instead)
      • mise: use brew bundle instead
  • Scope code, e.g.,:
    • Formulae should be bumped only during a release, so do not perform bumps in scripts called by release workflow; instead, embed them in the workflow itself, otherwise people might incorrectly run the bump scripts outside of the workflow.
      • If, under extraordinary circumstances, someone must bump the formulae outside the release process, they should know enough about the release process to know that they should just copy the bump commands from the workflow.
  • Limit pathways, prevent bad values, & make config more explicit, e.g.:
    • bash scripts should accept only arguments, not environment variables
    • Release workflows & bash scripts should:
      • Require that the release tag is a properly formatted version tag.
      • Checkout the release version tag, then use that version tag as the source for the version & for the git commit.
      • Not accept arguments, environment variables, or anything else to specify version, tag, branch, revision, etc.
  • Replace script/version --write & script/version_bump with script/generate_version_info_for_swift
  • When working locally, versions used (e.g. in Sources/mas/Package.swift) for revisions that aren't directly tagged with a version tag are specified by the full git describe --tags output, which includes the number of commits since the tag & the current revision.
  • Cleanup release.yml job dependencies.
  • bash script cleanup:
    • cd into project root at beginning of every bash script.
    • Use -u in all bash shebangs
    • Lowercase all bash non-environment variables.

Improvements that are being worked on:

  • Ensure that release tag is a correctly formatted version tag.
  • Why does release.yml output release event info only when name != ''?
  • Dry run:
    • Specify dry run via argument to release.yml.
    • Dry run will only work with act, unless either:
      • The release workflow is manually triggered, instead of it being triggered by a release event:
        • The release process would create the release, but iff not a dry run & iff all prior steps succeeded.
      • The release workflow can retroactively cancel the release if it's a dry run or if any steps fail (probably not possible).
  • mas-cli/tap/mas / GitHub Release artifacts:
    • Include version (& platform? & macOS version?) in mas.pkg filename.
    • Provide 1.8.6 bottle for macOS 10.11 & 10.12, because 1.8.7+ requires macOS 10.13+.
    • Manually generate bottles for macOS 10.13 & 10.14, because brew bump-formula-pr probably won't do that.
    • Remove bottles from custom tap that are available from homebrew-core?
    • Instead of using a single universal executable for all supported macOS versions, generate bottles for each supported platform & version of macOS?

Future tasks include:

  • Cleanup actions/checkout@v4 output:
    • git config --global init.defaultBranch main
    • git config --global advice.detachedHead false
  • .actrc
    • Delete?
    • Repoint --eventpath .github/event.json to a path under git-ignored .build?
  • Dangerfile.swift appears to be used only for PRs made directly on mas-cli/mas, but not for those via forks:
    • Setup for fork PRs.
    • Or delete it.
  • YAML & JSON schemas for validation
  • Standardize file headers.
  • Shell script cleanup:
    • Switch to zsh?
    • Replace commands that are not shell builtins:
      • awk
      • grep
      • cut
      • sd
      • sed
  • GitHub branch & tag protections:
    • Require signed annotated tags (tag.gpgSign).
    • Disallow changing version tags.
    • Disallow creating version tags outside main except for old sub-patch version tags for branches named for the patch version.
    • Ensure that each new release has one & only one semantic version component that is one greater than some other prior release version, followed by zeros for all subsequent components, with an optional -beta.1 suffix.
      • So, the following version transitions are OK:
        • 5.6.7 -> 6.0.0
        • 5.6.7 -> 5.7.0
        • 5.6.7 -> 5.6.8
        • 5.6.7 -> 5.6.8-beta.1
        • 5.6.7-beta.1 -> 5.6.7-beta.2
      • While the following version transitions are not OK:
        • (no stable 5.* exists) -> 6.0.0
        • (no stable 5.6.* exists) -> 5.7.0
        • (no stable 5.6.7.* exists) -> 5.6.8
        • (no stable 5.6.7.* exists) -> 5.6.8-beta.1
        • (no 5.6.7-beta.1 exists) -> 5.6.7-beta.2

Resolve #638

@rgoldberg rgoldberg force-pushed the 638-release-improvements branch 6 times, most recently from 03de1d2 to 8306c6e Compare November 17, 2024 00:13
@rgoldberg rgoldberg force-pushed the 638-release-improvements branch 7 times, most recently from 0faa0f8 to ef6bd6e Compare November 18, 2024 06:56
@rgoldberg
Copy link
Contributor Author

@phatblat I've incorporated your fixes from the 638/release-fixes branch in this repo into my branch for this PR, so you can restart using the branch from this PR.

If you have any other fixes that weren't already in that branch in this repo at the time when this comment was posted, please share them with me so I can incorporate them into the branch for this PR.

Thanks.

@rgoldberg rgoldberg force-pushed the 638-release-improvements branch 4 times, most recently from f06fedd to 4856cee Compare November 20, 2024 06:07
@rgoldberg rgoldberg mentioned this pull request Nov 20, 2024
@rgoldberg rgoldberg added this to the 1.8.8 milestone Nov 21, 2024
@rgoldberg rgoldberg force-pushed the 638-release-improvements branch 2 times, most recently from 9016365 to c169e88 Compare November 21, 2024 03:59
…sistent with the shebangs that are used throughout.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
…sion values.

It only seems to be used for testing with `act`. `event.json` should either be generated or be manually created; in either case, it should reside somewhere that is ignored by git, as the only source of version info in git should be version tags.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
`brew_core_update`: disable tracing & cleanup script.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
Cleanup comments / documentation / spacing.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
…f an output from `start` job.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
…e_release` output from `start` job.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
…ller` to ensure that custom tap isn't bumped if the package installer wasn't uploaded to the GitHub release.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
…ify & speedup workflow.

Move all environment variables to the top level.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
…into `release.yml`.

Run `git rev-parse …` instead of `git rev-list -n 1 …` for mas-cli/tap/mas.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
Requires corresponding commits to `homebrew-core/mas` & `mas-cli/tap/mas` formulae.

Rename `dstroot` variable as `distributions_root` in `script/package`.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
Should only release revisions that have version tags on them, so should only need a single commit.

`ref:` should default to the reference for the event, which should be `github.event.release.tag_name`, so shouldn't need to explicitly set it.

If any of these changes cause problems, will back them out.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
`script/package` calls
`script/build --universal` instead of requiring the latter to be called before the former.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
…` target has been merged into `mas` target.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
… tag & current revision for local (i.e. non-release builds), since releases should all be for a version tagged revision.

Partial mas-cli#638

Signed-off-by: Ross Goldberg <[email protected]>
@rgoldberg rgoldberg self-assigned this Nov 21, 2024
@rgoldberg rgoldberg added the 🧽 chore Administrative task: documentation, build, test, release, git, etc. label Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧽 chore Administrative task: documentation, build, test, release, git, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve release process
2 participants