@coze-arch/rush-publish-plugin 0.0.5-alpha.e7fa7b → 0.0.5-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,14 @@
1
+ import { type PublishManifest } from './types';
1
2
  export declare function createAndPushBranch(branchName: string, cwd: string): Promise<void>;
2
3
  interface CommitChangesOptions {
4
+ sessionId: string;
3
5
  files: string[];
4
6
  cwd: string;
7
+ publishManifests: PublishManifest[];
5
8
  branchName: string;
9
+ createTags: boolean;
6
10
  }
7
- export declare function commitChanges({ files, cwd, branchName, }: CommitChangesOptions): Promise<{
11
+ export declare function commitChanges({ sessionId, files, cwd, publishManifests, branchName, createTags, }: CommitChangesOptions): Promise<{
8
12
  effects: string[];
9
13
  branchName: string;
10
14
  }>;
package/lib/index.js CHANGED
@@ -854,15 +854,31 @@ const generatePublishManifest = async (
854
854
 
855
855
 
856
856
 
857
+
858
+
859
+
857
860
  async function commitChanges({
861
+ sessionId,
858
862
  files,
859
863
  cwd,
864
+ publishManifests,
860
865
  branchName,
866
+ createTags,
861
867
  }) {
862
868
  await exec(`git add ${files.join(' ')}`, { cwd });
863
869
  await exec(`git commit -m "chore: Publish ${branchName}" -n`, { cwd });
864
870
 
865
- return { effects: [branchName], branchName };
871
+ let tags = [];
872
+ if (createTags) {
873
+ tags = publishManifests.map(
874
+ m => `v/${m.project.packageName}@${m.newVersion}`,
875
+ );
876
+ await exec(
877
+ tags.map(tag => `git tag -a ${tag} -m "Bump type ${tag}"`).join(' && '),
878
+ { cwd },
879
+ );
880
+ }
881
+ return { effects: [...tags, branchName], branchName };
866
882
  }
867
883
 
868
884
 
@@ -898,6 +914,7 @@ const pushToRemote = async (options) => {
898
914
  sessionId,
899
915
  changedFiles,
900
916
  cwd,
917
+ publishManifests,
901
918
  bumpPolicy,
902
919
  skipCommit,
903
920
  skipPush,
@@ -925,9 +942,13 @@ const pushToRemote = async (options) => {
925
942
 
926
943
  // 4. 创建并推送发布分支
927
944
  const { effects } = await commitChanges({
945
+ sessionId,
928
946
  files: changedFiles,
929
947
  cwd,
948
+ publishManifests,
930
949
  branchName,
950
+ // 只有 alpha、beta 需要创建 tag,正式发布会在 .github/workflows/common-pr-checks.yml 创建并发布tag
951
+ createTags: isTestPublish,
931
952
  });
932
953
  if (skipPush) {
933
954
  return;
@@ -1633,6 +1654,7 @@ const publish = async (options) => {
1633
1654
  } else {
1634
1655
  // 普通模式:创建并推送发布分支
1635
1656
  await pushToRemote({
1657
+ publishManifests,
1636
1658
  bumpPolicy: bumpPolicy ,
1637
1659
  sessionId,
1638
1660
  changedFiles,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coze-arch/rush-publish-plugin",
3
- "version": "0.0.5-alpha.e7fa7b",
3
+ "version": "0.0.5-beta.1",
4
4
  "description": "rush plugin to generate change log and publish packages",
5
5
  "keywords": [
6
6
  "rush",