File tree Expand file tree Collapse file tree 3 files changed +28
-11
lines changed
common/changes/@coze-arch/rush-publish-plugin
packages/rush-plugins/publish/src/action/publish Expand file tree Collapse file tree 3 files changed +28
-11
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "changes" : [
3
+ {
4
+ "packageName" : " @coze-arch/rush-publish-plugin" ,
5
+ "comment" : " better logic" ,
6
+ "type" : " patch"
7
+ }
8
+ ],
9
+ "packageName" : " @coze-arch/rush-publish-plugin" ,
10
+ "email" : " tecvan.fe@gmail.com"
11
+ }
Original file line number Diff line number Diff line change @@ -26,24 +26,29 @@ interface CommitChangesOptions {
26
26
cwd : string ;
27
27
publishManifests : PublishManifest [ ] ;
28
28
branchName : string ;
29
+ createTags : boolean ;
29
30
}
30
31
export async function commitChanges ( {
31
32
sessionId,
32
33
files,
33
34
cwd,
34
35
publishManifests,
35
36
branchName,
37
+ createTags,
36
38
} : CommitChangesOptions ) : Promise < { effects : string [ ] ; branchName : string } > {
37
39
await exec ( `git add ${ files . join ( ' ' ) } ` , { cwd } ) ;
38
40
await exec ( `git commit -m "chore: Publish ${ branchName } " -n` , { cwd } ) ;
39
41
40
- const tags = publishManifests . map (
41
- m => `v/${ m . project . packageName } @${ m . newVersion } ` ,
42
- ) ;
43
- await exec (
44
- tags . map ( tag => `git tag -a ${ tag } -m "Bump type ${ tag } "` ) . join ( ' && ' ) ,
45
- { cwd } ,
46
- ) ;
42
+ let tags : string [ ] = [ ] ;
43
+ if ( createTags ) {
44
+ tags = publishManifests . map (
45
+ m => `v/${ m . project . packageName } @${ m . newVersion } ` ,
46
+ ) ;
47
+ await exec (
48
+ tags . map ( tag => `git tag -a ${ tag } -m "Bump type ${ tag } "` ) . join ( ' && ' ) ,
49
+ { cwd } ,
50
+ ) ;
51
+ }
47
52
return { effects : [ ...tags , branchName ] , branchName } ;
48
53
}
49
54
Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ export const pushToRemote = async (options: PushToRemoteOptions) => {
44
44
branchName = `release/${ date } -${ sessionId } ` ;
45
45
await exec ( `git checkout -b ${ branchName } ` , { cwd } ) ;
46
46
}
47
+ const isTestPublish = [ BumpType . ALPHA , BumpType . BETA ] . includes (
48
+ bumpPolicy as BumpType ,
49
+ ) ;
47
50
48
51
// 4. 创建并推送发布分支
49
52
const { effects } = await commitChanges ( {
@@ -52,6 +55,8 @@ export const pushToRemote = async (options: PushToRemoteOptions) => {
52
55
cwd,
53
56
publishManifests,
54
57
branchName,
58
+ // 只有 alpha、beta 需要创建 tag,正式发布会在 .github/workflows/common-pr-checks.yml 创建并发布tag
59
+ createTags : isTestPublish ,
55
60
} ) ;
56
61
if ( skipPush ) {
57
62
return ;
@@ -62,10 +67,6 @@ export const pushToRemote = async (options: PushToRemoteOptions) => {
62
67
repoUrl : actualRepoUrl ,
63
68
} ) ;
64
69
65
- const isTestPublish = [ BumpType . ALPHA , BumpType . BETA ] . includes (
66
- bumpPolicy as BumpType ,
67
- ) ;
68
-
69
70
// 从 git URL 提取组织和仓库名称,用于构建 GitHub 链接
70
71
const repoInfoMatch = actualRepoUrl . match ( GIT_REPO_URL_REGEX ) ;
71
72
if ( ! repoInfoMatch ) {
You can’t perform that action at this time.
0 commit comments