build/controllers/ReleaseController.php
public function actionRelease(array $what)
    {
        if (\count($what) > 1) {
            $this->stdout("Currently only one simultaneous release is supported.\n");
            return 1;
        }

        $this->stdout("This is the Yii release manager\n\n", Console::BOLD);

        if ($this->dryRun) {
            $this->stdout("Running in \"dry-run\" mode, nothing will actually be changed.\n\n", Console::BOLD, Console::FG_GREEN);
        }

        $this->validateWhat($what);
        $versions = $this->getCurrentVersions($what);

        if ($this->version !== null) {
            // if a version is explicitly given
            $newVersions = [];
            foreach ($versions as $k => $v) {
                $newVersions[$k] = $this->version;
            }
        } else {
            // otherwise get next patch or minor
            $newVersions = $this->getNextVersions($versions, self::PATCH);
        }

        $this->stdout("You are about to prepare a new release for the following things:\n\n");
        $this->printWhat($what, $newVersions, $versions);
        $this->stdout("\n");

        $this->stdout("Before you make a release briefly go over the changes and check if you spot obvious mistakes:\n\n", Console::BOLD);
        $gitDir = reset($what) === 'framework' ? 'framework/' : '';
        $gitVersion = $versions[reset($what)];
        if (strncmp('app-', reset($what), 4) !== 0) {
            $this->stdout("- no accidentally added CHANGELOG lines for other versions than this one?\n\n    git diff $gitVersion.. ${gitDir}CHANGELOG.md\n\n");
            $this->stdout("- are all new `@since` tags for this release version?\n");
        }
        $this->stdout("- other issues with code changes?\n\n    git diff -w $gitVersion.. ${gitDir}\n\n");
        $travisUrl = reset($what) === 'framework' ? '' : '-' . reset($what);
        $this->stdout("- are unit tests passing on travis? https://travis-ci.org/yiisoft/yii2$travisUrl/builds\n");
        $this->stdout("- also make sure the milestone on github is complete and no issues or PRs are left open.\n\n");
        $this->printWhatUrls($what, $versions);
        $this->stdout("\n");

        if (!$this->confirm('When you continue, this tool will run cleanup jobs and update the changelog as well as other files (locally). Continue?', false)) {
            $this->stdout("Canceled.\n");
            return 1;
        }

        foreach ($what as $ext) {
            if ($ext === 'framework') {
                $this->releaseFramework("{$this->basePath}/framework", $newVersions['framework']);
            } elseif (strncmp('app-', $ext, 4) === 0) {
                $this->releaseApplication(substr($ext, 4), "{$this->basePath}/apps/" . substr($ext, 4), $newVersions[$ext]);
            } else {
                $this->releaseExtension($ext, "{$this->basePath}/extensions/$ext", $newVersions[$ext]);
            }
        }

        return 0;
    }
public function actionRelease(array $what)
    {
        if (\count($what) > 1) {
            $this->stdout("Currently only one simultaneous release is supported.\n");
            return 1;
        }

        $this->stdout("This is the Yii release manager\n\n", Console::BOLD);

        if ($this->dryRun) {
            $this->stdout("Running in \"dry-run\" mode, nothing will actually be changed.\n\n", Console::BOLD, Console::FG_GREEN);
        }

        $this->validateWhat($what);
        $versions = $this->getCurrentVersions($what);

        if ($this->version !== null) {
            // if a version is explicitly given
            $newVersions = [];
            foreach ($versions as $k => $v) {
                $newVersions[$k] = $this->version;
            }
        } else {
            // otherwise get next patch or minor
            $newVersions = $this->getNextVersions($versions, self::PATCH);
        }

        $this->stdout("You are about to prepare a new release for the following things:\n\n");
        $this->printWhat($what, $newVersions, $versions);
        $this->stdout("\n");

        $this->stdout("Before you make a release briefly go over the changes and check if you spot obvious mistakes:\n\n", Console::BOLD);
        $gitDir = reset($what) === 'framework' ? 'framework/' : '';
        $gitVersion = $versions[reset($what)];
        if (strncmp('app-', reset($what), 4) !== 0) {
            $this->stdout("- no accidentally added CHANGELOG lines for other versions than this one?\n\n    git diff $gitVersion.. ${gitDir}CHANGELOG.md\n\n");
            $this->stdout("- are all new `@since` tags for this release version?\n");
        }
        $this->stdout("- other issues with code changes?\n\n    git diff -w $gitVersion.. ${gitDir}\n\n");
        $travisUrl = reset($what) === 'framework' ? '' : '-' . reset($what);
        $this->stdout("- are unit tests passing on travis? https://travis-ci.org/yiisoft/yii2$travisUrl/builds\n");
        $this->stdout("- also make sure the milestone on github is complete and no issues or PRs are left open.\n\n");
        $this->printWhatUrls($what, $versions);
        $this->stdout("\n");

        if (!$this->confirm('When you continue, this tool will run cleanup jobs and update the changelog as well as other files (locally). Continue?', false)) {
            $this->stdout("Canceled.\n");
            return 1;
        }

        foreach ($what as $ext) {
            if ($ext === 'framework') {
                $this->releaseFramework("{$this->basePath}/framework", $newVersions['framework']);
            } elseif (strncmp('app-', $ext, 4) === 0) {
                $this->releaseApplication(substr($ext, 4), "{$this->basePath}/apps/" . substr($ext, 4), $newVersions[$ext]);
            } else {
                $this->releaseExtension($ext, "{$this->basePath}/extensions/$ext", $newVersions[$ext]);
            }
        }

        return 0;
    }
Automation tool for making Yii framework and official extension releases.

Usage:

To make a release, make sure your git is clean (no uncommitted changes) and run the following command in
the yii dev repo root:

```
./build/build release framework
```

or

```
./build/build release redis,bootstrap,apidoc
```

You may use the `--dryRun` switch to test the command without changing or pushing anything:

```
./build/build release redis --dryRun
```

The command will guide you through the complete release process including changing of files,
committing and pushing them. Each git command must be confirmed and can be skipped individually.
You may adjust changes in a separate shell or your IDE while the command is waiting for confirmation.

@param array $what what do you want to release? this can either be:

- an extension name such as `redis` or `bootstrap`,
- an application indicated by prefix `app-`, e.g. `app-basic`,
- or `framework` if you want to release a new version of the framework itself.

@return int