Skip to content

Commit

Permalink
Updated Releaser
Browse files Browse the repository at this point in the history
  • Loading branch information
JanBliznicenko committed Sep 30, 2024
1 parent 344530f commit 4791fb0
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 56 deletions.
6 changes: 3 additions & 3 deletions repository/BaselineOfOpenPonk/BaselineOfOpenPonk.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ BaselineOfOpenPonk >> internalProjectsBaseline: spec [

spec baseline: 'NewTools' with: [
spec
repository: 'github://pharo-spec/NewTools:Pharo11';
repository: 'github://pharo-spec/NewTools:Pharo12';
loads: #( FileBrowser ) ].
spec
baseline: 'SynchronizedLinks'
Expand All @@ -82,7 +82,7 @@ BaselineOfOpenPonk >> removeExplicitRequirementsFromPackage: aPackageName [

| regExp packages |
regExp := '*' , aPackageName , '*'.
packages := RPackageOrganizer default packages select: [ :each |
packages := PackageOrganizer default packages select: [ :each |
regExp match: each name ].
packages do: [ :each |
Transcript crShow:
Expand All @@ -100,7 +100,7 @@ BaselineOfOpenPonk >> removePackage: aPackageName [

| regExp packages |
regExp := '*' , aPackageName , '*'.
packages := RPackageOrganizer default packages select: [ :each |
packages := PackageOrganizer default packages select: [ :each |
regExp match: each name ].
packages do: [ :each |
Transcript crShow: 'Removing package ' , each name.
Expand Down
141 changes: 88 additions & 53 deletions repository/OpenPonk-Releaser/OPReleaser.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ Class {
#name : 'OPReleaser',
#superclass : 'Object',
#instVars : [
'repository',
'repositoryName',
'versionArray',
'nightlyBranchName',
Expand Down Expand Up @@ -44,22 +43,71 @@ OPReleaser class >> releaseRepository: aName branch: aString asVersion: anArrayO
inspectGitCommands
]

{ #category : 'instance creation' }
OPReleaser >> branch: aBranchName [

nightlyBranchName := aBranchName
]

{ #category : 'actions' }
OPReleaser >> commitAndPush [
OPReleaser >> checkoutLocalReleaseBranch [

| releaseBranchModel |
"grab local release_base"
releaseBranch := repo allBranches detect: [ :b |
b name = 'release_base' ].
releaseBranchModel := IceTipBranchModel
repositoryModel: repoModel
on: releaseBranch.

"perform checkout via GUI"
releaseBranchModel previewCheckout.

"------------- HANDLE OPEN WINDOWS IF ANY ----------------"
"------- MAKE NECESSARY CHANGES BY HAND IN THE BASELINE/CODE -------"
self confirmToContinue:
'If any window opened, handle checkout release_base, then proceed'
]

{ #category : 'actions' }
OPReleaser >> checkoutRemoteReleaseBranch [
"grab remote branch"

| remoteBranchModel |
remoteBranch := repo allBranches detect: [ :b |
b name = 'origin/release_base' ].
remoteBranchModel := IceTipBranchModel
repositoryModel: repoModel
on: remoteBranch.

"if not available locally, yet, checkout remote"
repo allBranches
detect: [ :b | b name = 'release_base' ]
ifNone: [ "perform checkout via GUI"
remoteBranchModel previewCheckout ].

"------------- HANDLE OPEN WINDOWS IF ANY ----------------"
self confirmToContinue:
'If any window opened, handle checkout release_base, then proceed'
]

{ #category : 'actions' }
OPReleaser >> commit [

| commitBrowser |

"------------- HANDLE OPEN WINDOWS IF ANY ----------------"
"------- MAKE NECESSARY CHANGES BY HAND IN THE BASELINE/CODE -------"

self confirmToContinue:
'Handle open merge window, make neccessary changes in the baseline, then proceed'.

"commit via GUI"
(IceTipCommitBrowser onRepository: repo) open.
commitBrowser := IceTipCommitBrowser onRepository: repo.
commitBrowser commentPanel commentText text: 'Updated baseline'.
commitBrowser open.

"------------- HANDLE OPEN WINDOWS IF ANY ----------------"
self confirmToContinue: 'Handle commit window, then proceed'.

"push the changes to GitHub"
releaseBranch pushTo: remoteBranch remote
self confirmToContinue: 'Handle commit window, then proceed'
]

{ #category : 'utilities' }
Expand All @@ -73,9 +121,11 @@ OPReleaser >> confirmToContinue: aText [
OPReleaser >> createRelease [

self getRepo.
self getRemoteReleaseBranch.
self getLocalReleaseBranch.
self commitAndPush.
self checkoutRemoteReleaseBranch.
self checkoutLocalReleaseBranch.
self pullReleaseBranchAndMerge.
self commit.
self push.
self createTags.
^ self getGitCommands
]
Expand Down Expand Up @@ -123,54 +173,14 @@ OPReleaser >> getGitCommands [
^ gitCommands := String streamContents: [ :s |
s << 'pushd "' << repo location fullName << '"'.
s lf.
s << ('git push --delete origin ' , minorTag).
s << 'git push --delete origin ' << minorTag.
s lf.
s << ('git push --delete origin ' , majorTag).
s << 'git push --delete origin ' << majorTag.
s lf.
s << 'git push --tags'.
s lf ]
]

{ #category : 'actions' }
OPReleaser >> getLocalReleaseBranch [
"pull to ensure it is up to date"

| masterBranch masterBranchModel |
releaseBranch pullFrom: remoteBranch remote.


"get master branch"
masterBranch := repo allBranches detect: [ :b | b name = 'master' ].
masterBranchModel := IceTipBranchModel
repositoryModel: repoModel
on: masterBranch.

"merge master branch into the currently checked-out (which is the release branch)"
masterBranchModel previewMerge: IceTipMergeType direct
]

{ #category : 'actions' }
OPReleaser >> getRemoteReleaseBranch [
"grab remote branch"

| remoteBranchModel |
remoteBranch := repo allBranches detect: [ :b |
b name = 'origin/release_base' ].
remoteBranchModel := IceTipBranchModel
repositoryModel: repoModel
on: remoteBranch.

"if not available locally, yet, checkout remote"
repo allBranches
detect: [ :b | b name = 'release_base' ]
ifNone: [ "perform checkout via GUI"
remoteBranchModel previewCheckout ].

"------------- HANDLE OPEN WINDOWS IF ANY ----------------"
self confirmToContinue:
'If any window opened, handle checkout release_base, then proceed'
]

{ #category : 'actions' }
OPReleaser >> getRepo [

Expand All @@ -194,6 +204,31 @@ OPReleaser >> inspectGitCommands [
yourself
]

{ #category : 'actions' }
OPReleaser >> pullReleaseBranchAndMerge [

| masterBranch masterBranchModel |

"pull to ensure it is up to date"
releaseBranch pullFrom: remoteBranch remote.

"get master branch"
masterBranch := repo allBranches detect: [ :b | b name = nightlyBranchName ].
masterBranchModel := IceTipBranchModel
repositoryModel: repoModel
on: masterBranch.

"merge master branch into the currently checked-out (which is the release branch)"
masterBranchModel previewMerge: IceTipMergeType direct
]

{ #category : 'actions' }
OPReleaser >> push [
"push the changes to GitHub"

releaseBranch pushTo: remoteBranch remote
]

{ #category : 'accessing' }
OPReleaser >> repositoryName: aString [

Expand Down

0 comments on commit 4791fb0

Please sign in to comment.