Bill’s Blog Release Process
Detailed steps to finalize a Feature/Bugfix/Post branch, merge it with main
, and release a new version of the site.
Assumptions
This process document was written assuming the developer is using Visual Studio Code (VSC) with both GitLens and GitGraph plugins. Instructions in this document may refer to either interactions with the VSC plugins, or may be provided as Git commands to be run in a CLI.
This process document assumes that there is no development work directly on main
. All changes are done in separate branches. There are currently three kinds of development branches.
- Feature branches - these branches are where new features to the site are developed and tested. They may include Bugfix work when the bug is minor and fixing it can be rolled into new feature effort. A Feature release can also incorporate new Post(s) work when a Release milestone calls for a new post, e.g. the posts in the ongoing series “How I setup this Github Pages blog site” are part of each version’s Feature effort, and one such post is released with each Feature release. When a Feature branch is merged into
main
, the Major or Minor numbers of the site’s Semantic Version will be incremented. - Bugfix branches - these branches are created to fix bugs that have been recorded in the repository’s Issues list. These are typically short lived branches with very limited changes, aimed at addressing specific deficiencies in the site. They are typically developed in parallel with Feature branches. When a Bugfix branch is merged into
main
, the Patch number (third part of the Semantic Version) will be incremented. - Post branches - a new branch created for the purpose of releasing a new published post, or significant editorial reworking of an existing published post. These branches are typically very short-lived, and are used to move a post from the draft state to a published state. When a Post branch is merged into
main
, the patch number of the site’s Version will be incremented.
Git branches are lightweight and easy to create. This document assumes that there are “more than one” active branches, and that all development work is being tracked in a branch. This document is focused on the steps needed to release / merge one active development branch into main
, and update the production site with the work done on the development branch.
The branch being released will be referred to as the Release Candidate in this document.
Ensure the <Feat/Bug/Post-Branch> meets release criteria and is built atop the latest main
Prerequisites:
- The development work on the branch meets the criteria set out in the Bill’s Blog Pre-Release Checklist. This ensures the new work meets the standards expected for a release.
- The
main
branch has no changes to it since the last Release tag was applied. Themain
branch builds and serves cleanly, with the value of the environment variableJEKYLL_ENV
set to ‘production’ and without the--drafts
option.
Steps:
- Ensure the
main
branch builds cleanly, without the--drafts
option. - Checkout the <Feat/Bug/Post-Branch> (the Release Candidate).
- Publish all draft posts that are part of this release.
- Run
$env:JEKYLL_ENV = 'production'; bundle exec jekyll serve
to ensure that_site
is built with no drafts and with comments enabled. - Run
git rebase -i main
to pull any prior release changes tomain
into the Release Candidate branch. Following the Bill’s Blog Pre-Release Checklist should ensure that this step has already been done, but redoing this step here ensures that no recent updates tomain
are missed. If there are no recent updates, this step takes very little time / effort. - If there are any recent updates to
main
, then rebase the Release Candidate branch ontomain
, and recheck the Release Candidate branch with Bill’s Blog Pre-Release Checklist to ensure the changes didn’t break anything, and restart this release process. - Always ensure that
$env:JEKYLL_ENV = 'production'; bundle exec jekyll serve
is run after the final Release Candidate code change is made, so that_site
is up-to-date.
Final soft reset and commit on the <Feat/Bug/Post-Branch>
The purpose of the soft reset and commit is to clean up the commit messages and make them ready for the ChangeLog, and to cleanup all the changes and eliminate dross in the change list. If the individual commit messages have been well written, the chore of making a good <Feat/Bug/Post-Branch> release commit message shouldn’t be too hard.
Create the summary commit message from the commits made on the Release Candidate branch
-
Run
git log --pretty="format:%b" HEAD...$(git merge-base main $(git rev-parse --abbrev-ref HEAD)) > $env:TEMP/git_message_for_squash.md
-
Run
code $env:TEMP/git_message_for_squash.md
- Edit the file and create the summary commit message for the release.
- Copy the summary commit message into the
ChangeLog.md
file. - Run
$env:JEKYLL_ENV = 'production'; bundle exec jekyll serve
and validate theChangeLog
page looks as expected. Stop the local Jekyll server.
Soft-reset the Release Candidate branch to eliminate mis-steps in the branch development
-
Run the following to reset the head of the Release Candidate branch to the head of
main
.git reset --soft $(git merge-base main $(git rev-parse --abbrev-ref HEAD))
- Run
git add .
to add the current state of the Release Candidate branch to the next commit. - Run
git commit
. Title should beFEAT Milestone VX.XX.XXX
, orBugFix Issue #XX
, orPost "<ShortTitle>"
Paste the final commit message as the body of the commit. Close the editor.
At this point the Release Candidate should be complete. If you discover additional issues to be addressed, fix them and then repeat the steps in this section.
Merge the Release Candidate branch with the main
branch
Many organizations require a pull request to perform a merge. That’s a great idea as soon as your site has any collaborators, but its overkill for a solo developer. I’ll add instructions and templates for a Pull Request process in a later update to this post. For now just merge the two branches.
- Run
git checkout main
to change to themain
branch. - Run
git merge <Feat/Bug/Post-Branch>
to perform the merge. If the Bill’s Blog Pre-Release Checklist was followed, there should be no merge conflicts. - Commit all changes on
main
. UseChore Release Work for <Feat/Bug/Post-Branch>
as the commit title
Add a Release tag
Now that the merge has been made, add a Release tag to main
.
- Run
git tag -a releases/X.XX.XXX -m "Fourth release of Bill's Blog"
Modify the command as appropriate for the specific release being made - Run
git tag
(which will list all existing tags) and verify the new tag is there.
Final build of production site
- Run
$env:JEKYLL_ENV = 'production'; bundle exec jekyll serve
- Validate the final production build, including the Release Version in the footer, is correct.
- Commit all changes on
main
(these should only be_site
changes). Note the commit ID. - Run
git tag -f releases/X.XX.XXX
which should produce the resultUpdated tag 'releases/X.XX.XXX' (was c7f1fab)
(the commit number will always be different from this example). This will move the tag forward to the most recent commit. - View the tag locally to ensure it is present and associated with the correct commit ID (should be the very latest commit on
main
). - Run
git push --atomic origin main refs/tags/releases/X.XX.XXX
to push both the final commit onmain
AND the associated release tag to GitHub. - Validate that the
Deploy
Github Action was invoked and ran successfully. See Review the workflow run for details - Validate the production site is up, with the new features, new published posts, and correct Release Version number.
Rebase all active branches onto the new HEAD of main
Now that the Release Candidate branch has been merged into main
and the official release to production has ocurred, all/any active branches should be rebased onto the new HEAD of the main
branch.
Repeat the following steps for all active Feat/Bug/Post-Branch
branches
- Checkout
Feat/Bug/Post-Branch
- Run
git rebase -i main
- Resolve any merge conflicts
Review the commit log. If there are a number of commits in the bugfix branch, squash them together, and edit the comments to be a clean edited description of the changes.
Comments