-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: korjaa seuraavan versionumeron päättely patchaamalla semantic-re…
…lease (#571)
- Loading branch information
1 parent
ccbbddc
commit 48dd343
Showing
3 changed files
with
55 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
# Kopioi korjaus bugiin, jonka takia useammat alpha-channelit menevät sekaisin uutta versiota päätellessä. | ||
# Korjaus on PR:ssä https://github.com/semantic-release/semantic-release/pull/2416. | ||
# Koska korjausta ei ole valmiiksi saatavilla, tämä skripti patchaa semantic-releasen. | ||
|
||
cp ./deployment/patch/get-last-release.js_patch ./deployment/node_modules/semantic-release/lib/get-last-release.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const {isUndefined} = require('lodash'); | ||
const semver = require('semver'); | ||
const {makeTag, isSameChannel} = require('./utils'); | ||
|
||
/** | ||
* Last release. | ||
* | ||
* @typedef {Object} LastRelease | ||
* @property {string} version The version number of the last release. | ||
* @property {string} gitHead The Git reference used to make the last release. | ||
* @property {string} gitTag The git tag associated with the last release. | ||
* @property {string} channel The channel on which of the last release was published. | ||
* @property {string} name The name of the last release. | ||
*/ | ||
|
||
/** | ||
* Determine the Git tag and version of the last tagged release. | ||
* | ||
* - Filter out the branch tags that are not valid semantic version | ||
* - Sort the versions | ||
* - Retrive the highest version | ||
* | ||
* @param {Object} context semantic-release context. | ||
* @param {Object} params Function parameters. | ||
* @param {Object} params.before Find only releases with version number lower than this version. | ||
* | ||
* @return {LastRelease} The last tagged release or empty object if none is found. | ||
*/ | ||
module.exports = ({branch, options: {tagFormat}}, {before} = {}) => { | ||
const [{version, gitTag, channels} = {}] = branch.tags | ||
.filter( | ||
(tag) => | ||
((branch.type === 'prerelease' && tag.channels.some((channel) => isSameChannel(branch.channel, channel)) && | ||
semver | ||
.parse(tag.version) | ||
.prerelease.includes(branch.prerelease === true ? branch.name : branch.prerelease)) || | ||
!semver.prerelease(tag.version)) && | ||
(isUndefined(before) || semver.lt(tag.version, before)) | ||
) | ||
.sort((a, b) => semver.rcompare(a.version, b.version)); | ||
|
||
if (gitTag) { | ||
return {version, gitTag, channels, gitHead: gitTag, name: makeTag(tagFormat, version)}; | ||
} | ||
|
||
return {}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters