From 1f7cfd2b35243e664dbb94ab62ca364401ff714b Mon Sep 17 00:00:00 2001 From: gpickin Date: Fri, 25 Aug 2023 15:25:06 -0700 Subject: [PATCH 01/24] Make sure the header for Job Token matches the type of Tokens --- models/plugins/GitLabReleasePublicizer.cfc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/models/plugins/GitLabReleasePublicizer.cfc b/models/plugins/GitLabReleasePublicizer.cfc index 060a17b..02139a3 100644 --- a/models/plugins/GitLabReleasePublicizer.cfc +++ b/models/plugins/GitLabReleasePublicizer.cfc @@ -33,7 +33,12 @@ component implements="interfaces.ReleasePublicizer" { ) { cfhttpparam( type="header", - name="PRIVATE-TOKEN", + name="Content-Type", + value="application/json" + ); + cfhttpparam( + type="header", + name="JOB-TOKEN", value="#systemSettings.getSystemSetting( "CI_JOB_TOKEN" )#" ); cfhttpparam( type = "body", value = serializeJSON( { From 6baecae7cf815d70c970664e7e0f125b0537013f Mon Sep 17 00:00:00 2001 From: gpickin Date: Fri, 25 Aug 2023 16:12:01 -0700 Subject: [PATCH 02/24] Reset PreRelease and BuildID when getting last version --- commands/semantic-release.cfc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index 492d3e6..d8592a9 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -190,13 +190,15 @@ component { private string function getNextVersionNumber( required string lastVersion, required string type, string preReleaseID = "", string buildID = "" ) { var versionInfo = semanticVersion.parseVersion( lastVersion ); - versionInfo.preReleaseID = ( len( arguments.preReleaseID ) ? arguments.preReleaseID : versionInfo.preReleaseID ); - versionInfo.buildID = ( len( arguments.buildID ) ? arguments.buildID : versionInfo.buildID ); + versionInfo.preReleaseID = arguments.preReleaseID; + versionInfo.buildID = arguments.buildID; if ( lastVersion == "0.0.0" ) { versionInfo.major = 1; versionInfo.minor = 0; versionInfo.revision = 0; + versionInfo.preReleaseID = ""; + versionInfo.buildID = ""; return semanticVersion.getVersionAsString( versionInfo ); } From 0e91ac71af85c0140fce89f616d808bdbea40cb6 Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 12:41:25 -0700 Subject: [PATCH 03/24] Fix the BuildID --- commands/semantic-release.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index d8592a9..882150e 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -198,7 +198,7 @@ component { versionInfo.minor = 0; versionInfo.revision = 0; versionInfo.preReleaseID = ""; - versionInfo.buildID = ""; + versionInfo.buildID = 0; return semanticVersion.getVersionAsString( versionInfo ); } From ed339ecaa6cea7e380fe1d75ad31b8c31c6be689 Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 12:49:55 -0700 Subject: [PATCH 04/24] Add default buildID of 0 --- commands/semantic-release.cfc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index 882150e..ef7fef0 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -20,7 +20,7 @@ component { property name="PublicizeRelease" inject="PublicizeRelease@commandbox-semantic-release"; property name="targetBranch" inject="commandbox:moduleSettings:commandbox-semantic-release:targetBranch"; - function run( dryRun = false, verbose = false, force = false, targetBranch = variables.targetBranch, preReleaseID = systemSettings.getSystemSetting( "BUILD_VERSION_PRERELEASEID", "" ), buildID = systemSettings.getSystemSetting( "BUILD_VERSION_BUILDID", "" ) ) { + function run( dryRun = false, verbose = false, force = false, targetBranch = variables.targetBranch, preReleaseID = systemSettings.getSystemSetting( "BUILD_VERSION_PRERELEASEID", "" ), buildID = systemSettings.getSystemSetting( "BUILD_VERSION_BUILDID", 0 ) ) { if ( dryRun ) { print.line() .boldBlackOnYellowLine( " " ) @@ -88,7 +88,7 @@ component { .indentedWhite( "Next release type: " ) .line( " #type# ", getTypeColor( type ) ); - var nextVersion = getNextVersionNumber( lastVersion, type, preReleaseID, buildID ); + var nextVersion = getNextVersionNumber( lastVersion, type, arguments.preReleaseID, arguments.buildID ); print.indentedGreen( "✓" ) .indentedWhite( "Next version number: " ) .whiteOnCyanLine( " #nextVersion# " ) @@ -188,7 +188,7 @@ component { } } - private string function getNextVersionNumber( required string lastVersion, required string type, string preReleaseID = "", string buildID = "" ) { + private string function getNextVersionNumber( required string lastVersion, required string type, string preReleaseID = "", string buildID = 0 ) { var versionInfo = semanticVersion.parseVersion( lastVersion ); versionInfo.preReleaseID = arguments.preReleaseID; versionInfo.buildID = arguments.buildID; From 64ec70f0cafc6cc7edecc7a4ddd05c995872e0f8 Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 12:53:02 -0700 Subject: [PATCH 05/24] Add more verbose debugging --- commands/semantic-release.cfc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index ef7fef0..ba5c3be 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -21,6 +21,11 @@ component { property name="targetBranch" inject="commandbox:moduleSettings:commandbox-semantic-release:targetBranch"; function run( dryRun = false, verbose = false, force = false, targetBranch = variables.targetBranch, preReleaseID = systemSettings.getSystemSetting( "BUILD_VERSION_PRERELEASEID", "" ), buildID = systemSettings.getSystemSetting( "BUILD_VERSION_BUILDID", 0 ) ) { + if( verbose ){ + print.boldWhiteOnBlackLine( "Arguments to Command" ).toConsole(); + print.line( serializeJSON( arguments ) ).toConsole(); + } + if ( dryRun ) { print.line() .boldBlackOnYellowLine( " " ) @@ -224,6 +229,10 @@ component { versionInfo.revision += 1; break; } + if( verbose ){ + print.boldWhiteOnBlackLine( "Version Info" ).toConsole(); + print.line( serializeJSON( versionInfo ) ).toConsole(); + } return semanticVersion.getVersionAsString( versionInfo ) } From a54ced5a7a159f74a0ec689f9e4d0ab4e037e86e Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 13:23:50 -0700 Subject: [PATCH 06/24] Fix Verbose issue in versionInfo --- commands/semantic-release.cfc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index ba5c3be..e2115a1 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -229,10 +229,10 @@ component { versionInfo.revision += 1; break; } - if( verbose ){ - print.boldWhiteOnBlackLine( "Version Info" ).toConsole(); - print.line( serializeJSON( versionInfo ) ).toConsole(); - } + + print.boldWhiteOnBlackLine( "Version Info" ).toConsole(); + print.table( [ versionInfo ] ).toConsole(); + return semanticVersion.getVersionAsString( versionInfo ) } From 94bf58b7313d7981cd96bc476e66657096c5947d Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 13:58:30 -0700 Subject: [PATCH 07/24] Update Private-Token to Job-Token --- models/plugins/GitLabArtifactsCommitter.cfc | 2 +- models/plugins/GitLabReleaseFetcher.cfc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/models/plugins/GitLabArtifactsCommitter.cfc b/models/plugins/GitLabArtifactsCommitter.cfc index 0ae8b24..87fc66e 100644 --- a/models/plugins/GitLabArtifactsCommitter.cfc +++ b/models/plugins/GitLabArtifactsCommitter.cfc @@ -64,7 +64,7 @@ component implements="interfaces.ArtifactsCommitter" { .call(); var credentials = createObject( "java", "org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider" ) - .init( "PRIVATE-TOKEN", systemSettings.getSystemSetting( "CI_JOB_TOKEN" ) ); + .init( "JOB-TOKEN", systemSettings.getSystemSetting( "CI_JOB_TOKEN" ) ); jGit.push() .setCredentialsProvider( credentials ) diff --git a/models/plugins/GitLabReleaseFetcher.cfc b/models/plugins/GitLabReleaseFetcher.cfc index a27e7b9..eb88810 100644 --- a/models/plugins/GitLabReleaseFetcher.cfc +++ b/models/plugins/GitLabReleaseFetcher.cfc @@ -25,7 +25,7 @@ component implements="interfaces.ReleaseFetcher" { ) { cfhttpparam( type="header", - name="PRIVATE-TOKEN", + name="JOB-TOKEN", value="#systemSettings.getSystemSetting( "CI_JOB_TOKEN" )#" ); }; From 36d5cad7332391df0ed6e3e4386d8f2bba815b11 Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 14:19:43 -0700 Subject: [PATCH 08/24] Test different token --- models/plugins/GitLabArtifactsCommitter.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/plugins/GitLabArtifactsCommitter.cfc b/models/plugins/GitLabArtifactsCommitter.cfc index 87fc66e..d1245d2 100644 --- a/models/plugins/GitLabArtifactsCommitter.cfc +++ b/models/plugins/GitLabArtifactsCommitter.cfc @@ -64,7 +64,7 @@ component implements="interfaces.ArtifactsCommitter" { .call(); var credentials = createObject( "java", "org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider" ) - .init( "JOB-TOKEN", systemSettings.getSystemSetting( "CI_JOB_TOKEN" ) ); + .init( "JOB-TOKEN", systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" ) ); jGit.push() .setCredentialsProvider( credentials ) From 57c062ab43cee7688b0a92c9ace505e793cc7c5a Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 14:27:38 -0700 Subject: [PATCH 09/24] Update gitlab token --- models/plugins/GitLabArtifactsCommitter.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/plugins/GitLabArtifactsCommitter.cfc b/models/plugins/GitLabArtifactsCommitter.cfc index d1245d2..2c050d1 100644 --- a/models/plugins/GitLabArtifactsCommitter.cfc +++ b/models/plugins/GitLabArtifactsCommitter.cfc @@ -64,7 +64,7 @@ component implements="interfaces.ArtifactsCommitter" { .call(); var credentials = createObject( "java", "org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider" ) - .init( "JOB-TOKEN", systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" ) ); + .init( "PRIVATE-TOKEN", systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" ) ); jGit.push() .setCredentialsProvider( credentials ) From 00bd8670b92881eddf3e90f1e4a5f6f7d2a9d9d2 Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 14:47:42 -0700 Subject: [PATCH 10/24] Update gitlab tokens --- commands/semantic-release.cfc | 4 ++-- models/plugins/GitLabReleaseFetcher.cfc | 2 +- models/plugins/GitLabReleasePublicizer.cfc | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index e2115a1..2b5cb20 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -130,7 +130,7 @@ component { .indentedWhiteLine( "Release published" ) .toConsole(); - CommitArtifacts.run( nextVersion, dryRun, verbose, targetBranch ); + CommitArtifacts.run( nextVersion, dryRun, verbose, arguments.targetBranch ); print.indentedGreen( "✓" ) .indentedWhiteLine( "Artifacts committed" ) .toConsole(); @@ -141,7 +141,7 @@ component { getPackageRepositoryURL(), dryRun, verbose, - targetBranch + arguments.targetBranch ); print.indentedGreen( "✓" ) .indentedWhiteLine( "Release publicized" ) diff --git a/models/plugins/GitLabReleaseFetcher.cfc b/models/plugins/GitLabReleaseFetcher.cfc index eb88810..1666fb4 100644 --- a/models/plugins/GitLabReleaseFetcher.cfc +++ b/models/plugins/GitLabReleaseFetcher.cfc @@ -26,7 +26,7 @@ component implements="interfaces.ReleaseFetcher" { cfhttpparam( type="header", name="JOB-TOKEN", - value="#systemSettings.getSystemSetting( "CI_JOB_TOKEN" )#" + value="#systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" )#" ); }; var res = deserializeJSON( httpResponse.filecontent ); diff --git a/models/plugins/GitLabReleasePublicizer.cfc b/models/plugins/GitLabReleasePublicizer.cfc index 02139a3..3cabbb3 100644 --- a/models/plugins/GitLabReleasePublicizer.cfc +++ b/models/plugins/GitLabReleasePublicizer.cfc @@ -39,12 +39,12 @@ component implements="interfaces.ReleasePublicizer" { cfhttpparam( type="header", name="JOB-TOKEN", - value="#systemSettings.getSystemSetting( "CI_JOB_TOKEN" )#" + value="#systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" )#" ); cfhttpparam( type = "body", value = serializeJSON( { "name": "#versionPrefix##nextVersion#", "tag_name": "#versionPrefix##nextVersion#", - "ref": targetBranch, + "ref": arguments.targetBranch, "description": notes } ) ); } From 8120bb8e9ba9c8dcc9fd77304dbd51f53a20f20d Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 15:00:37 -0700 Subject: [PATCH 11/24] Clean up duplicate config --- ModuleConfig.cfc | 2 -- 1 file changed, 2 deletions(-) diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index c126ca5..f86e3f8 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -66,8 +66,6 @@ component { binder.map( "GitHubReleasePublicizer@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.GitHubReleasePublicizer" ); - binder.map( "GitLabConditionsVerifier@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.GitLabConditionsVerifier" ); binder.map( "GitLabArtifactsCommitter@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.GitLabArtifactsCommitter" ); binder.map( "GitLabReleaseFetcher@commandbox-semantic-release" ) From 1f9fe31dfd25e6aa2630130f45da7eca2792d778 Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 15:00:56 -0700 Subject: [PATCH 12/24] Ensure the targetBranch is passed to ConditionsVerifier --- commands/semantic-release.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index 2b5cb20..81aa627 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -38,7 +38,7 @@ component { if ( force ) { print.yellowLine( "Skipping verification checks due to force flag" ).toConsole(); } - else if ( ! VerifyConditions.run( dryRun, verbose ) ) { + else if ( ! VerifyConditions.run( dryRun, verbose, arguments.targetBranch ) ) { print.yellowLine( "Verify conditions check failed — switching to dry run mode." ).toConsole(); arguments.dryRun = true; print.line() From 22c396c02200941f15bfd108ce520ac831b4061d Mon Sep 17 00:00:00 2001 From: gpickin Date: Sat, 26 Aug 2023 18:38:43 -0700 Subject: [PATCH 13/24] Change gitlab tokens back to CI_JOB_TOKEN --- models/plugins/GitLabArtifactsCommitter.cfc | 2 +- models/plugins/GitLabReleaseFetcher.cfc | 2 +- models/plugins/GitLabReleasePublicizer.cfc | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/models/plugins/GitLabArtifactsCommitter.cfc b/models/plugins/GitLabArtifactsCommitter.cfc index 2c050d1..0ae8b24 100644 --- a/models/plugins/GitLabArtifactsCommitter.cfc +++ b/models/plugins/GitLabArtifactsCommitter.cfc @@ -64,7 +64,7 @@ component implements="interfaces.ArtifactsCommitter" { .call(); var credentials = createObject( "java", "org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider" ) - .init( "PRIVATE-TOKEN", systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" ) ); + .init( "PRIVATE-TOKEN", systemSettings.getSystemSetting( "CI_JOB_TOKEN" ) ); jGit.push() .setCredentialsProvider( credentials ) diff --git a/models/plugins/GitLabReleaseFetcher.cfc b/models/plugins/GitLabReleaseFetcher.cfc index 1666fb4..eb88810 100644 --- a/models/plugins/GitLabReleaseFetcher.cfc +++ b/models/plugins/GitLabReleaseFetcher.cfc @@ -26,7 +26,7 @@ component implements="interfaces.ReleaseFetcher" { cfhttpparam( type="header", name="JOB-TOKEN", - value="#systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" )#" + value="#systemSettings.getSystemSetting( "CI_JOB_TOKEN" )#" ); }; var res = deserializeJSON( httpResponse.filecontent ); diff --git a/models/plugins/GitLabReleasePublicizer.cfc b/models/plugins/GitLabReleasePublicizer.cfc index 3cabbb3..949823c 100644 --- a/models/plugins/GitLabReleasePublicizer.cfc +++ b/models/plugins/GitLabReleasePublicizer.cfc @@ -39,7 +39,7 @@ component implements="interfaces.ReleasePublicizer" { cfhttpparam( type="header", name="JOB-TOKEN", - value="#systemSettings.getSystemSetting( "GITLAB_ACCESS_TOKEN" )#" + value="#systemSettings.getSystemSetting( "CI_JOB_TOKEN" )#" ); cfhttpparam( type = "body", value = serializeJSON( { "name": "#versionPrefix##nextVersion#", From f7d68d68cdd5bfcdb3b1b5f494a8cd5333cd2265 Mon Sep 17 00:00:00 2001 From: gpickin Date: Sun, 27 Aug 2023 12:43:41 -0700 Subject: [PATCH 14/24] Add NullNotesGenerator to plugins --- models/plugins/NullNotesGenerator.cfc | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 models/plugins/NullNotesGenerator.cfc diff --git a/models/plugins/NullNotesGenerator.cfc b/models/plugins/NullNotesGenerator.cfc new file mode 100644 index 0000000..feab062 --- /dev/null +++ b/models/plugins/NullNotesGenerator.cfc @@ -0,0 +1,28 @@ +component implements="interfaces.NotesGenerator" { + + /** + * Generates markdown notes for the new release on GitHub + * + * @lastVersion The last version of the package. + * @nextVersion The next version of the package. + * @commits An array of commits between the two versions. + * @type The type of the next release: major, minor, or patch. + * @repositoryUrl The url of the remote repository. + * @dryRun Flag to indicate a dry run of the release. + * @verbose Flag to indicate printing out extra information. + * + * @return A string containing the new notes for the release. + */ + public string function run( + required string lastVersion, + required string nextVersion, + required array commits, + required string type, + required string repositoryUrl, + boolean dryRun = false, + boolean verbose = true + ) { + return ""; + } + +} From f6ba53ec95961d04e69899bfc1ea0f432876bdcb Mon Sep 17 00:00:00 2001 From: gpickin Date: Sun, 27 Aug 2023 12:44:40 -0700 Subject: [PATCH 15/24] Add Null Notes Generator to config - reordered to sync plugins. --- ModuleConfig.cfc | 54 +++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index f86e3f8..89d78a3 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -10,7 +10,6 @@ component { "changelogFileName" = "CHANGELOG.md", "targetBranch" = "master", "buildCommitMessage" = "__SEMANTIC RELEASE VERSION UPDATE__", - "plugins-VerifyConditions" = "GitHubActionsConditionsVerifier@commandbox-semantic-release", "plugins-VerifyConditions-buildTimeout" = 600, // seconds "plugins-VerifyConditions-pollingInterval" = 5, // seconds @@ -29,49 +28,52 @@ component { "plugins-PublicizeRelease" = "GitHubReleasePublicizer@commandbox-semantic-release" }; - binder.map( "TravisConditionsVerifier@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.TravisConditionsVerifier" ); - binder.map( "NullConditionsVerifier@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.NullConditionsVerifier" ); - binder.map( "GitLabConditionsVerifier@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.GitLabConditionsVerifier" ); - binder.map( "GitHubActionsConditionsVerifier@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.GitHubActionsConditionsVerifier" ); - binder.map( "ForgeBoxReleaseFetcher@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.ForgeBoxReleaseFetcher" ); - binder.map( "JGitCommitsRetriever@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.JGitCommitsRetriever" ); binder.map( "ConventionalChangelogParser@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.ConventionalChangelogParser" ); - binder.map( "EmojiLogCommitParser@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.EmojiLogCommitParser" ); - binder.map( "DefaultCommitFilterer@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.DefaultCommitFilterer" ); binder.map( "DefaultCommitAnalyzer@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.DefaultCommitAnalyzer" ); + binder.map( "DefaultCommitFilterer@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.DefaultCommitFilterer" ); binder.map( "EmojiLogCommitAnalyzer@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.EmojiLogCommitAnalyzer" ); - binder.map( "NullReleaseVerifier@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.NullReleaseVerifier" ); - binder.map( "GitHubMarkdownNotesGenerator@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.GitHubMarkdownNotesGenerator" ); + binder.map( "EmojiLogCommitParser@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.EmojiLogCommitParser" ); binder.map( "FileAppendChangelogUpdater@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.FileAppendChangelogUpdater" ); - binder.map( "NullArtifactsCommitter@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.NullArtifactsCommitter" ); - binder.map( "GitHubArtifactsCommitter@commandbox-semantic-release" ) - .to( "#moduleMapping#.models.plugins.GitHubArtifactsCommitter" ); + binder.map( "ForgeBoxReleaseFetcher@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.ForgeBoxReleaseFetcher" ); binder.map( "ForgeBoxReleasePublisher@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.ForgeBoxReleasePublisher" ); + binder.map( "GitHubActionsConditionsVerifier@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.GitHubActionsConditionsVerifier" ); + binder.map( "GitHubArtifactsCommitter@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.GitHubArtifactsCommitter" ); + binder.map( "GitHubMarkdownNotesGenerator@commandbox-semantic-release" ). + to( "#moduleMapping#.models.plugins.GitHubMarkdownNotesGenerator" ); binder.map( "GitHubReleasePublicizer@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.GitHubReleasePublicizer" ); - binder.map( "GitLabArtifactsCommitter@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.GitLabArtifactsCommitter" ); + binder.map( "GitLabConditionsVerifier@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.GitLabConditionsVerifier" ); binder.map( "GitLabReleaseFetcher@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.GitLabReleaseFetcher" ); binder.map( "GitLabReleasePublicizer@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.GitLabReleasePublicizer" ); + binder.map( "JGitCommitsRetriever@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.JGitCommitsRetriever" ); + binder.map( "NullArtifactsCommitter@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.NullArtifactsCommitter" ); + binder.map( "NullConditionsVerifier@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.NullConditionsVerifier" ); + binder.map( "NullNotesGenerator@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.NullNotesGenerator" ); + binder.map( "NullReleasePublisher@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.NullReleasePublisher" ); + binder.map( "NullReleaseVerifier@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.NullReleaseVerifier" ); + binder.map( "TravisConditionsVerifier@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.TravisConditionsVerifier" ); } function onLoad() { From 48e11aa36fa4e895b96a5c0efc61778302ccccde Mon Sep 17 00:00:00 2001 From: gpickin Date: Sun, 27 Aug 2023 14:35:31 -0700 Subject: [PATCH 16/24] Clean up ReadMe --- README.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 4b4e2e3..4450b1f 100644 --- a/README.md +++ b/README.md @@ -359,7 +359,7 @@ a struct for each of the plugin interfaces. Arbitrary keys and values can be set via the command line. ``` -box config set modules.settings.commandbox-semantic-release.plugins-VerifyConditions-buildTimeout=1000 +box config set modules.commandbox-semantic-release.plugins-VerifyConditions-buildTimeout=1000 ``` These values can then be used in your plugins: @@ -392,10 +392,9 @@ You set your custom plugins or settings via CommandBox just prior to calling the after_success: - box install commandbox-semantic-release - box config set endpoints.forgebox.APIToken=${FORGEBOX_TOKEN} - - box config set modules.settings.commandbox-semantic-release.versionPrefix = "" - - box config set modules.settings.commandbox-semantic-release.plugins-GenerateNotes = "MyCustomNotesGenerator@commandbox-semantic-release-custom-notes" + - box config set modules.commandbox-semantic-release.versionPrefix = "" + - box config set modules.commandbox-semantic-release.plugins-GenerateNotes = "MyCustomNotesGenerator@commandbox-semantic-release-custom-notes" - box config set modules.commandbox-semantic-release.plugins-VerifyConditions="GitLabConditionsVerifier@commandbox-semantic-release" - - box config set modules.commandbox-semantic-release.plugins-GenerateNotes="GitHubMarkdownNotesGenerator@commandbox-semantic-release" - box config set modules.commandbox-semantic-release.plugins-CommitArtifacts="GitLabArtifactsCommitter@commandbox-semantic-release" - box config set modules.commandbox-semantic-release.plugins-PublicizeRelease="GitLabReleasePublicizer@commandbox-semantic-release" - box semantic-release From 76c989dcebb302d79f91296de92ffc90f798b751 Mon Sep 17 00:00:00 2001 From: gpickin Date: Mon, 28 Aug 2023 10:49:32 -0700 Subject: [PATCH 17/24] Add NullChangeLogCommitter --- ModuleConfig.cfc | 2 ++ models/plugins/NullChangelogUpdater.cfc | 29 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 models/plugins/NullChangelogUpdater.cfc diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 89d78a3..4165c3b 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -64,6 +64,8 @@ component { .to( "#moduleMapping#.models.plugins.JGitCommitsRetriever" ); binder.map( "NullArtifactsCommitter@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.NullArtifactsCommitter" ); + binder.map( "NullChangelogUpdater@commandbox-semantic-release" ) + .to( "#moduleMapping#.models.plugins.NullChangelogUpdater" ); binder.map( "NullConditionsVerifier@commandbox-semantic-release" ) .to( "#moduleMapping#.models.plugins.NullConditionsVerifier" ); binder.map( "NullNotesGenerator@commandbox-semantic-release" ) diff --git a/models/plugins/NullChangelogUpdater.cfc b/models/plugins/NullChangelogUpdater.cfc new file mode 100644 index 0000000..6dac977 --- /dev/null +++ b/models/plugins/NullChangelogUpdater.cfc @@ -0,0 +1,29 @@ +component implements="interfaces.ChangelogUpdater" { + + property name="print" inject="PrintBuffer"; + + /** + * Updates the current changelog with the new notes. + * + * @notes The notes for the new release. + * @dryRun Flag to indicate a dry run of the release. + * @verbose Flag to indicate printing out extra information. + */ + public void function run( + required string notes, + required string nextVersion, + boolean dryRun = false, + boolean verbose = false + ) { + + if ( verbose ) { + print.line() + .indented() + .boldBlackOnYellowLine( " NULL CHANGELOG UPDATER - NO CHANGELOG WRITTEN " ) + .line() + .toConsole(); + } + + } + +} From 693eb600c37cd3598bcd657965e2102f14aa1ce1 Mon Sep 17 00:00:00 2001 From: gpickin Date: Tue, 5 Sep 2023 15:47:06 -0700 Subject: [PATCH 18/24] Add optional config for skipping box.json updates --- ModuleConfig.cfc | 1 + models/plugins/GitHubArtifactsCommitter.cfc | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ModuleConfig.cfc b/ModuleConfig.cfc index 4165c3b..2277315 100644 --- a/ModuleConfig.cfc +++ b/ModuleConfig.cfc @@ -24,6 +24,7 @@ component { "plugins-CommitArtifacts" = "GitHubArtifactsCommitter@commandbox-semantic-release", "plugins-CommitArtifacts-authorName" = "CommandBox Semantic Release", "plugins-CommitArtifacts-authorEmail" = "csr@example.com", + "plugins-CommitArtifacts-commitBoxJson" = true, "plugins-PublishRelease" = "ForgeBoxReleasePublisher@commandbox-semantic-release", "plugins-PublicizeRelease" = "GitHubReleasePublicizer@commandbox-semantic-release" }; diff --git a/models/plugins/GitHubArtifactsCommitter.cfc b/models/plugins/GitHubArtifactsCommitter.cfc index 67a973d..d7d7021 100644 --- a/models/plugins/GitHubArtifactsCommitter.cfc +++ b/models/plugins/GitHubArtifactsCommitter.cfc @@ -46,8 +46,13 @@ component implements="interfaces.ArtifactsCommitter" { .setName( targetBranch ) .call(); + if( options[ "plugins-CommitArtifacts-commitBoxJson" ] == true ) { + jGit.add() + .addFilePattern( "box.json" ) + .call(); + } + jGit.add() - .addFilePattern( "box.json" ) .addFilePattern( changelogFileName ) .call(); From 5f45c4995ae133b6c8604f20c0af5e92321eaeee Mon Sep 17 00:00:00 2001 From: gpickin Date: Wed, 6 Sep 2023 10:49:38 -0700 Subject: [PATCH 19/24] Add gitlab box,json fix --- models/plugins/GitLabArtifactsCommitter.cfc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/models/plugins/GitLabArtifactsCommitter.cfc b/models/plugins/GitLabArtifactsCommitter.cfc index 0ae8b24..0db2bb6 100644 --- a/models/plugins/GitLabArtifactsCommitter.cfc +++ b/models/plugins/GitLabArtifactsCommitter.cfc @@ -45,8 +45,13 @@ component implements="interfaces.ArtifactsCommitter" { .setName( targetBranch ) .call(); + if( options[ "plugins-CommitArtifacts-commitBoxJson" ] == true ) { + jGit.add() + .addFilePattern( "box.json" ) + .call(); + } + jGit.add() - .addFilePattern( "box.json" ) .addFilePattern( changelogFileName ) .call(); From 177d469bfc6cc30e32fecd5545d7d9b81508df5d Mon Sep 17 00:00:00 2001 From: gpickin Date: Wed, 6 Sep 2023 10:58:26 -0700 Subject: [PATCH 20/24] Add options Injection --- models/plugins/GitLabArtifactsCommitter.cfc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/plugins/GitLabArtifactsCommitter.cfc b/models/plugins/GitLabArtifactsCommitter.cfc index 0db2bb6..5dbd6e1 100644 --- a/models/plugins/GitLabArtifactsCommitter.cfc +++ b/models/plugins/GitLabArtifactsCommitter.cfc @@ -7,7 +7,8 @@ component implements="interfaces.ArtifactsCommitter" { property name="changelogFileName" inject="commandbox:moduleSettings:commandbox-semantic-release:changelogFileName"; property name="versionPrefix" inject="commandbox:moduleSettings:commandbox-semantic-release:versionPrefix"; property name="targetBranch" inject="commandbox:moduleSettings:commandbox-semantic-release:targetBranch"; - + property name="options" inject="commandbox:moduleSettings:commandbox-semantic-release"; + /** * Set up jGit for the current repository. */ From 16fef1c3db8ab3db9c94d987a44182671b1f8eee Mon Sep 17 00:00:00 2001 From: gpickin Date: Thu, 21 Sep 2023 22:51:10 -0700 Subject: [PATCH 21/24] added getPackageVersion to create better starting version --- commands/semantic-release.cfc | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index 81aa627..b3aa577 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -193,17 +193,30 @@ component { } } + private string function getPackageVersion() { + var path = fileSystemUtil.resolvePath( "" ); + if ( ! packageService.isPackage( path ) ) { + return "0.0.0"; + } + return packageService.readPackageDescriptor( path ).version; + } + private string function getNextVersionNumber( required string lastVersion, required string type, string preReleaseID = "", string buildID = 0 ) { var versionInfo = semanticVersion.parseVersion( lastVersion ); versionInfo.preReleaseID = arguments.preReleaseID; versionInfo.buildID = arguments.buildID; if ( lastVersion == "0.0.0" ) { - versionInfo.major = 1; - versionInfo.minor = 0; - versionInfo.revision = 0; - versionInfo.preReleaseID = ""; - versionInfo.buildID = 0; + var currentPackageVersion = getPackageVersion(); + if ( currentPackageVersion != semanticVersion.parseVersion( currentPackageVersion ).major ) { + versionInfo = semanticVersion.parseVersion( currentPackageVersion ); + } else { + versionInfo.major = 1; + versionInfo.minor = 0; + versionInfo.revision = 0; + versionInfo.preReleaseID = ""; + versionInfo.buildID = 0; + } return semanticVersion.getVersionAsString( versionInfo ); } From cc8b2671f1f9e1024e422cab3cebeb858d0ccc1f Mon Sep 17 00:00:00 2001 From: gpickin Date: Thu, 21 Sep 2023 23:14:48 -0700 Subject: [PATCH 22/24] Update for first versions to allow preReleaseID and buildID --- commands/semantic-release.cfc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index b3aa577..3e2f3bb 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -203,8 +203,6 @@ component { private string function getNextVersionNumber( required string lastVersion, required string type, string preReleaseID = "", string buildID = 0 ) { var versionInfo = semanticVersion.parseVersion( lastVersion ); - versionInfo.preReleaseID = arguments.preReleaseID; - versionInfo.buildID = arguments.buildID; if ( lastVersion == "0.0.0" ) { var currentPackageVersion = getPackageVersion(); @@ -217,6 +215,8 @@ component { versionInfo.preReleaseID = ""; versionInfo.buildID = 0; } + versionInfo.preReleaseID = arguments.preReleaseID; + versionInfo.buildID = arguments.buildID; return semanticVersion.getVersionAsString( versionInfo ); } From 27faff0f2e4ffd8f3bdeb1198b24558055c7f1c1 Mon Sep 17 00:00:00 2001 From: gpickin Date: Fri, 22 Sep 2023 13:56:00 -0700 Subject: [PATCH 23/24] Fix the prerelease an buildID from past versions --- commands/semantic-release.cfc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/semantic-release.cfc b/commands/semantic-release.cfc index 3e2f3bb..7f4e4d9 100644 --- a/commands/semantic-release.cfc +++ b/commands/semantic-release.cfc @@ -245,7 +245,9 @@ component { print.boldWhiteOnBlackLine( "Version Info" ).toConsole(); print.table( [ versionInfo ] ).toConsole(); - + + versionInfo.preReleaseID = arguments.preReleaseID; + versionInfo.buildID = arguments.buildID; return semanticVersion.getVersionAsString( versionInfo ) } From 7202accd2805fdc19975b9e910c14acd71e45d51 Mon Sep 17 00:00:00 2001 From: gpickin Date: Fri, 29 Sep 2023 15:05:31 -0700 Subject: [PATCH 24/24] Fix Gitlab Fetcher Array Syntax --- models/plugins/GitLabReleaseFetcher.cfc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/plugins/GitLabReleaseFetcher.cfc b/models/plugins/GitLabReleaseFetcher.cfc index eb88810..a2e4e6c 100644 --- a/models/plugins/GitLabReleaseFetcher.cfc +++ b/models/plugins/GitLabReleaseFetcher.cfc @@ -30,7 +30,7 @@ component implements="interfaces.ReleaseFetcher" { ); }; var res = deserializeJSON( httpResponse.filecontent ); - var tag = res.isEmpty() ? "0.0.0" : res.tag_name; + var tag = res.isEmpty() ? "0.0.0" : res[1].tag_name; return left( tag, 1 ) == "v" ? mid( tag, 2, tag.len() - 1 ) : tag; }