-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[batch-release] Step2 : Publish packages from the release branch #10459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| name: Batch Release | ||
| on: | ||
| push: | ||
| branches: | ||
| - 'release-go-router' | ||
| - 'release-material' | ||
| - 'release-cupertino' | ||
| jobs: | ||
| release: | ||
| uses: ./.github/workflows/release.yml | ||
| with: | ||
| publish-args: '--all-changed --batch-release --base-sha=HEAD~ --skip-confirmation --remote=origin' | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Wouldn't we need to pass in the branch name for releasing? looking at the release.yaml it seems to be using the main branch when running the publish. |
||
| workflow-name: 'Batch Release ${{ github.ref_name }}' | ||
| secrets: inherit | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| name: Main Release | ||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| jobs: | ||
| release: | ||
| uses: ./.github/workflows/release.yml | ||
| with: | ||
| publish-args: '--all-changed --base-sha=HEAD~ --skip-confirmation --remote=origin' | ||
| workflow-name: 'Main Release' | ||
| secrets: inherit |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,6 +83,10 @@ class PublishCommand extends PackageLoopingCommand { | |
| 'Release all packages that contains pubspec changes at the current commit compares to the base-sha.\n' | ||
| 'The --packages option is ignored if this is on.', | ||
| ); | ||
| argParser.addFlag( | ||
| _batchReleaseFlag, | ||
| help: 'only release the packages that opt-in for batch release option.', | ||
| ); | ||
| argParser.addFlag( | ||
| _dryRunFlag, | ||
| help: | ||
|
|
@@ -109,6 +113,7 @@ class PublishCommand extends PackageLoopingCommand { | |
| static const String _pubFlagsOption = 'pub-publish-flags'; | ||
| static const String _remoteOption = 'remote'; | ||
| static const String _allChangedFlag = 'all-changed'; | ||
| static const String _batchReleaseFlag = 'batch-release'; | ||
hannah-hyj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| static const String _dryRunFlag = 'dry-run'; | ||
| static const String _skipConfirmationFlag = 'skip-confirmation'; | ||
| static const String _tagForAutoPublishFlag = 'tag-for-auto-publish'; | ||
|
|
@@ -196,6 +201,39 @@ class PublishCommand extends PackageLoopingCommand { | |
| .toList(); | ||
|
|
||
| for (final pubspecPath in changedPubspecs) { | ||
| // Read the ci_config.yaml file if it exists | ||
|
|
||
| final String packageName = p.basename(p.dirname(pubspecPath)); | ||
| bool isBatchReleasePackage; | ||
| try { | ||
| final File ciConfigFile = packagesDir.fileSystem | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this may need to wait for #10485 where there is a new api to access batch release flags |
||
| .file(pubspecPath) | ||
| .parent | ||
| .childFile('ci_config.yaml'); | ||
| if (!ciConfigFile.existsSync()) { | ||
| isBatchReleasePackage = false; | ||
| } else { | ||
| final ciConfig = | ||
| loadYaml(ciConfigFile.readAsStringSync()) as YamlMap?; | ||
| final dynamic batchValue = | ||
| (ciConfig?['release'] as YamlMap?)?['batch']; | ||
| if (batchValue is! bool) { | ||
| printError( | ||
| '`release.batch` key is missing or not a boolean in ci_config.yaml for $packageName.', | ||
| ); | ||
| continue; | ||
| } | ||
| isBatchReleasePackage = batchValue; | ||
| } | ||
| } catch (e) { | ||
| printError('Could not parse ci_config.yaml for $packageName: $e'); | ||
| continue; | ||
| } | ||
| // Skip the package if batch release flag is not set to match the ci_config.yaml | ||
| if (getBoolArg(_batchReleaseFlag) != isBatchReleasePackage) { | ||
| continue; | ||
| } | ||
|
|
||
| // git outputs a relativa, Posix-style path. | ||
| final File pubspecFile = childFileWithSubcomponents( | ||
| packagesDir.fileSystem.directory((await gitDir).path), | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's keep this out for now until the decoupling and opts into batch release.