-
Notifications
You must be signed in to change notification settings - Fork 107
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: [IA-209] Update publiccode.yml when a new version of the app i…
…s released (#3335) * test * fix * update date * update publiccode.yml * fix * update comments * remove unused import * remove variable
- Loading branch information
1 parent
25f7bfa
commit a5fe299
Showing
3 changed files
with
52 additions
and
5 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
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
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,43 @@ | ||
/** | ||
* This is an updater for the utility "standard-version" that increase the versionName value | ||
* for publiccode.yml file. | ||
* Replace the line: | ||
* softwareVersion: $VERSION | ||
* with the new generated version. | ||
* | ||
* and the line: | ||
* releaseDate: '$DATE' | ||
* with the today date. | ||
* | ||
*/ | ||
|
||
const softwareVersionRegex = /(softwareVersion: )(.+)/gm; | ||
const releaseDateRegex = /(releaseDate: ')(.+)(')/gm; | ||
|
||
module.exports.readVersion = function (contents) { | ||
// return the 2nd group of the regex (the version) | ||
return softwareVersionRegex.exec(contents)[2]; | ||
}; | ||
|
||
function replaceReleaseDate(_, version, p1, p2, p3) { | ||
return [p1, version, p3].join(""); | ||
} | ||
|
||
function replaceVersionName(_, version, p1) { | ||
return [p1, version].join(""); | ||
} | ||
|
||
module.exports.writeVersion = function (contents, version) { | ||
// Update version | ||
contents = contents.replace(softwareVersionRegex, (substr, ...args) => | ||
replaceVersionName(substr, version, ...args) | ||
); | ||
const today = new Date().toISOString().split("T")[0]; | ||
|
||
// update date | ||
contents = contents.replace(releaseDateRegex, (substr, ...args) => | ||
replaceReleaseDate(substr, today, ...args) | ||
); | ||
|
||
return contents; | ||
}; |