11/71
Sign inSign up free

823. The Release Script Picked the Wrong Version

hard 40 XP ~14 minHands-on lab

The release job of docs-site runs scripts/next-version.sh (in /home/student/repos/docs-site) to decide the next version from the commit messages. For the current history it printed v1.4.3, but since v1.4.2 there's a new feature and a breaking change, so the right answer is v2.0.0.

Task

Fix the script. Run in a repository, it must print the next version as vMAJOR.MINOR.PATCH and exit 0:

  • The last release is the nearest tag that looks like v<digits>… (tags may be lightweight or annotated; other tags are ignored). With no such tag, start from 0.0.0 and consider every commit.
  • Look at every commit since that tag (subject and body):
    • a subject like type!: … or type(scope)!: …, or a body line starting with BREAKING CHANGE: → major (1.4.2 → 2.0.0),
    • otherwise, any feat: … or feat(scope): … → minor (1.4.2 → 1.5.0),
    • otherwise → patch (1.4.2 → 1.4.3).
  • With no commits since the tag, print the tag's version unchanged.

The grader runs your script in several freshly made repositories.

About this machine

Ubuntu 24.04 with no internet access. You are student with passwordless sudo. The grader checks the final state of the machine, not the commands you typed. Values like names and ports are generated for you.

Teaching or writing about this? Embed this lab on your page

TerminalNot started

Your machine is ready to start

A fresh, isolated Ubuntu machine boots in a few seconds with the task already set up.

No account needed: 3 of 3 free tries left. Guest machines last 30 minutes.