Skip to content

Commit 656e92b

Browse files
support patch releases
1 parent 0f3cef6 commit 656e92b

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

.github/scripts/utils.mjs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,22 @@ export function buildLibmongocryptDownloadUrl(ref, platform) {
3535
// sort of a hack - if we have an official release version, it'll be in the form `major.minor`. otherwise,
3636
// we'd expect a commit hash or `master`.
3737
if (ref.includes('.')) {
38-
const [major, minor, patch] = ref.split('.');
39-
if (patch !== '0') {
40-
throw new Error('cannot release from non-zero patch.');
41-
}
42-
38+
const [major, minor, _patch] = ref.split('.');
39+
40+
// Just a note: it may appear that this logic _doesn't_ support patch releases but it actually does.
41+
// libmongocrypt's creates release branches for minor releases in the form `r<major>.<minor>`.
42+
// Any patches made to this branch are committed as tags in the form <major>.<minor>.<patch>.
43+
// So, the branch that is used for the AWS s3 upload is `r<major>.<minor>` and the commit hash
44+
// is the commit hash we parse from the `getCommitFromRef()` (which handles switching to git tags and
45+
// getting the commit hash at that tag just fine).
4346
const branch = `r${major}.${minor}`
47+
4448
return `https://mciuploads.s3.amazonaws.com/libmongocrypt-release/${platform}/${branch}/${hash}/libmongocrypt.tar.gz`;
4549
}
4650

51+
// just a note here - `master` refers to the branch, the hash is the commit on that branch.
52+
// if we ever need to download binaries from a non-master branch (or non-release branch),
53+
// this will need to be modified somehow.
4754
return `https://mciuploads.s3.amazonaws.com/libmongocrypt/${platform}/master/${hash}/libmongocrypt.tar.gz`;
4855
}
4956

0 commit comments

Comments
 (0)