-
Notifications
You must be signed in to change notification settings - Fork 47
Default branch to main
instead of master
#172
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 8 commits
a31353f
cde4445
cd3b975
b39f1b1
9029b3c
e8ceda5
65063a2
185d000
82364c3
86e4ce8
8d5c751
d037b1a
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 |
---|---|---|
|
@@ -77,7 +77,7 @@ jobs: | |
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "John Doe" | ||
git config --global init.defaultBranch master # TODO: use main, need to adjust tests to match | ||
git config --global init.defaultBranch main | ||
|
||
- name: Run tests | ||
run: phpunit | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ cache.properties | |
bin | ||
!bin/UpdateApplicationVersionCurrentVersion.php | ||
.phpunit.result.cache | ||
.idea/ | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
vcs: git | ||
vcs: | ||
name: git | ||
main-branch: main | ||
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. Let's do one thing at a time. Let's first merge this PR and then after this, I will change the main branch name of this repo. So please set |
||
|
||
prerequisites: | ||
- working-copy-check: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,15 +6,15 @@ RMT - Release Management Tool | |
[](https://packagist.org/packages/liip/RMT) | ||
[](https://packagist.org/packages/liip/rmt) | ||
|
||
RMT is a handy tool to help releasing new versions of your software. You can define the type | ||
RMT is a handy tool to help releasing a new versions of your software. You can define the type | ||
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. new versionS. It was just before |
||
of version generator you want to use (e.g. semantic versioning), where you want to store | ||
the version (e.g. in a changelog file or as a VCS tag) and a list of actions that should be | ||
executed before or after the release of a new version. | ||
|
||
Installation | ||
------------ | ||
### Option 1: As a development dependency of your project | ||
In order to use RMT in your project you should use [Composer](http://getcomposer.org/) to install it | ||
To use RMT in your project you should use [Composer](http://getcomposer.org/) to install it | ||
as a dev-dependency. Just go to your project's root directory and execute: | ||
|
||
composer require --dev liip/rmt | ||
|
@@ -31,7 +31,7 @@ root folder. You can now start using RMT by executing: | |
Once there, your best option is to pick one of the [configuration examples](#configuration-examples) below | ||
and adapt it to your needs. | ||
|
||
If you are using a versioning tool, we recommend to add both Composer files (`composer.json` | ||
If you are using a versioning tool, we recommend adding both Composer files (`composer.json` | ||
and `composer.lock`), the RMT configuration file(`.rmt.yml`) and the `RMT` executable script | ||
to it. The `vendor` directory should be ignored as it is populated when running | ||
`composer install`. | ||
|
@@ -62,9 +62,9 @@ directly `./rmt.phar` or run it by invoking it through PHP via `php rmt.phar`. | |
For the usage substitute RMT with whatever variant you have decided to use. | ||
|
||
### Option 4: As Drifter role | ||
If your are using https://github.com/liip/drifter for your project, you just need three step | ||
If you are using https://github.com/liip/drifter for your project, you just need three step | ||
* Activate the `rmt` role | ||
* Re-run the provisionning `vagrant provision` | ||
* Re-run the provisioning `vagrant provision` | ||
* Init RMT for your project `php /home/vagrant/.config/composer/vendor/liip/rmt/RMT` | ||
|
||
Usage | ||
|
@@ -123,12 +123,12 @@ RMT also support JSON configs, but we recommend using YAML. | |
### Branch specific config | ||
|
||
Sometimes you want to use a different release strategy according to the VCS branch, e.g. you want to add CHANGELOG entries only in the `master` branch. To do so, you have to place your default config into a root element named `_default`, then you can override parts of this default config for the | ||
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. One missing |
||
branch `master`. Example: | ||
branch `main`. Example: | ||
|
||
_default: | ||
version-generator: "simple" | ||
version-persister: "vcs-tag" | ||
master: | ||
main: | ||
pre-release-actions: [changelog-update] | ||
|
||
You can use the command `RMT config` to see the merge result between _default and your current branch. | ||
|
@@ -138,7 +138,7 @@ You can use the command `RMT config` to see the merge result between _default an | |
Build-in version number generation strategies. | ||
|
||
* simple: This generator is doing a simple increment (1,2,3...) | ||
* semantic: A generator which implements [Semantic versioning](http://semver.org) | ||
* semantic: A generator, which implements [Semantic versioning](http://semver.org) | ||
* Option `allow-label` (boolean): To allow adding a label on a version (such as -beta, -rcXX) (default: *false*) | ||
* Option `type`: to force the version type | ||
* Option `label`: to force the label | ||
|
@@ -151,8 +151,8 @@ Build-in version number generation strategies. | |
Class in charge of saving/retrieving the version number. | ||
|
||
* vcs-tag: Save the version as a VCS tag | ||
* Option `tag-pattern`: Allow to provide a regex that all tag must match. This allow for example to release a version 1.X.X in a specific branch and to release a 2.X.X in a separate branch | ||
* Option `tag-prefix`: Allow to prefix all VCS tag with a string. You can have a numeric versionning but generation tags such as `v_2.3.4`. As a bonus you can use a specific placeholder: `{branch-name}` that will automatically inject the current branch name in the tag. So use, simple generation and `tag-prefix: "{branch-name}_"` and it will generate tag like `featureXY_1`, `featureXY_2`, etc... | ||
* Option `tag-pattern`: Allow to provide a regex that all tag must match. This allows for example to release a version 1.X.X in a specific branch and to release a 2.X.X in a separate branch | ||
* Option `tag-prefix`: Allow to prefix all VCS tag with a string. You can have a numeric versioning but generation tags such as `v_2.3.4`. As a bonus you can use a specific placeholder: `{branch-name}` that will automatically inject the current branch name in the tag. So use, simple generation and `tag-prefix: "{branch-name}_"` and it will generate tag like `featureXY_1`, `featureXY_2`, etc... | ||
|
||
* changelog: Save the version in the changelog file | ||
* Option `location`: Changelog file name an location (default: *CHANGELOG*) | ||
|
@@ -166,9 +166,9 @@ Prerequisite actions are executed before the interactive part. | |
* `display-last-changes`: display your last changes | ||
* `tests-check`: run the project test suite | ||
* Option `command`: command to run (default: *phpunit*) | ||
* Option `timeout`: the number of seconds after which the command times out (default: *60.0*) | ||
* Option `timeout`: the amount of seconds after which the command times out (default: *60.0*) | ||
* Option `expected_exit_code`: expected return code (default: *0*) | ||
* `composer-json-check`: run a validate on the composer.json | ||
* `composer-json-check`: run a validated on the composer.json | ||
* Option `composer`: how to run composer (default: *php composer.phar*) | ||
* `composer-stability-check`: will check if the composer.json is set to the right minimum-stability | ||
* Option `stability`: the stability that should be set in the minimum-stability field (default: *stable*) | ||
|
@@ -192,21 +192,21 @@ Actions can be used for pre or post release parts. | |
* Option `file`: path from .rmt.yml to changelog file (default: *CHANGELOG*) | ||
* Option `dump-commits`: write all commit messages since the last release into the | ||
changelog file (default: *false*) | ||
* Option `insert-at`: only for addTop formatter: Number of lines to skip from the | ||
* Option `insert-at`: only for addTop formatter: Amount lines to skip from the | ||
top of the changelog file before adding the release number (default: *0*) | ||
* Option `exclude-merge-commits`: Exclude merge commits from the changelog (default: *false*) | ||
* `vcs-commit`: commit all files of the working copy (only use it with the | ||
`working-copy-check` prerequisite) | ||
* Option `commit-message`: specify a custom commit message. %version% will be replaced by the current / next version strings. | ||
* `vcs-tag`: Tag the last commit | ||
* `vcs-publish`: Publish the changes (commits and tags) | ||
* `composer-update`: Update the version number in a composer file (note that when using packagist.org, it is recommended to not have a tag in composer.json as the version is handle by version control tags) | ||
* `composer-update`: Update the version number in a composer file (note that when using packagist.org, it is recommended to not have a tag in composer.json as the version is handled by version control tags) | ||
* `files-update`: Update the version in one or multiple files. For each file to update, please provide an array with | ||
* Option `file`: path to the file to update | ||
* Option `pattern`: optional, use to specify the string replacement pattern in your file. For example: | ||
`const VERSION = '%version%';` | ||
* `build-phar-package`: Builds a Phar package of the current project whose filename depends on the 'package-name' option and the deployed version: [package-name]-[version].phar | ||
* Option `package-name`: the name of the generate package | ||
* Option `package-name`: the name of the generated package | ||
* Option `destination`: the destination directory to build the package into. If prefixed with a slash, is considered absolute, otherwise relative to the project root. | ||
* Option `excluded-paths`: a regex of excluded paths, directly passed to the [Phar::buildFromDirectory](http://php.net/manual/en/phar.buildfromdirectory.php) method. Ex: `/^(?!.*cookbooks|.*\.vagrant|.*\.idea).*$/im` | ||
* Option `metadata`: an array of metadata describing the package. Ex author, project. Note: the release version is added by default but can be overridden here. | ||
|
@@ -228,7 +228,7 @@ Actions can be used for pre or post release parts. | |
Extend it | ||
--------- | ||
|
||
RMT is providing some existing actions, generators, and persisters. If needed you can add your own by creating a PHP script in your project, and referencing it in the configuration via it's relative path: | ||
RMT is providing some existing actions, generators and persisters. If needed you can add your own by creating a PHP script in your project, and referencing it in the configuration via it's relative path: | ||
|
||
version-generator: "bin/myOwnGenerator.php" | ||
|
||
|
@@ -284,7 +284,7 @@ Most of the time, it will be easier for you to pick up an example below and adap | |
prerequisites: [working-copy-check, display-last-changes] | ||
|
||
|
||
### Using Git tags with prefix, semantic versioning, updating two files and pushing automatically | ||
### Using Git tags with a prefix, semantic versioning, updating two files and pushing automatically | ||
|
||
vcs: git | ||
version-generator: semantic | ||
|
@@ -308,8 +308,8 @@ Most of the time, it will be easier for you to pick up an example below and adap | |
tag-prefix: "{branch-name}_" | ||
post-release-actions: [vcs-publish] | ||
|
||
# This entry allow to override some parameters for the master branch | ||
master: | ||
# This entry allow to override some parameters for the main branch | ||
main: | ||
prerequisites: [working-copy-check, display-last-changes] | ||
pre-release-actions: | ||
changelog-update: | ||
|
@@ -325,7 +325,7 @@ Most of the time, it will be easier for you to pick up an example below and adap | |
|
||
Contributing | ||
------------ | ||
If you would like to help, by submitting one of your action scripts, generators, or persisters. Or just by reporting a | ||
If you would like to help, by submitting one of your action scripts, generators or persisters. Or just by reporting a | ||
bug just go to the project page [https://github.com/liip/RMT](https://github.com/liip/RMT). | ||
|
||
If you provide a PR, try to associate it some unit or functional tests. See next section | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,6 +70,13 @@ protected function configure(): void | |
'choices_shortcuts' => array('g' => 'git', 'h' => 'hg', 'n' => 'none'), | ||
'default' => 'none', | ||
)), | ||
new InformationRequest('main-branch', array( | ||
'description' => 'The default branch you want to use', | ||
'type' => 'choice', | ||
'choices' => array('main', 'master'), | ||
'choices_shortcuts' => array('m' => 'main', 'mst' => 'master'), | ||
'default' => 'main', | ||
)), | ||
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. I don't like so much this question. If the user is saying
|
||
new InformationRequest('generator', array( | ||
'description' => 'The generator to use for version incrementing', | ||
'type' => 'choice', | ||
|
@@ -153,18 +160,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int | |
|
||
// Create the config file from a template | ||
$this->getOutput()->writeln("Creation of the config file <info>{$this->configPath}</info>"); | ||
$template = $this->informationCollector->getValueFor('vcs') == 'none' ? | ||
$template = $this->informationCollector->getValueFor('vcs') === 'none' ? | ||
__DIR__.'/../Config/templates/no-vcs-config.yml.tmpl' : | ||
__DIR__.'/../Config/templates/default-vcs-config.yml.tmpl' | ||
; | ||
$config = file_get_contents($template); | ||
$generator = $this->informationCollector->getValueFor('generator'); | ||
foreach (array( | ||
'generator' => $generator == 'semantic-versioning' ? | ||
'generator' => $generator === 'semantic-versioning' ? | ||
'semantic # More complex versionning (semantic)' : 'simple # Same simple versionning', | ||
'vcs' => $this->informationCollector->getValueFor('vcs'), | ||
'main-branch' => $this->informationCollector->getValueFor('main-branch'), | ||
'persister' => $this->informationCollector->getValueFor('persister'), | ||
'changelog-format' => $generator == 'semantic-versioning' ? 'semantic' : 'simple', | ||
'changelog-format' => $generator === 'semantic-versioning' ? 'semantic' : 'simple', | ||
) as $key => $value) { | ||
$config = str_replace("%%$key%%", $value, $config); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
_default: | ||
|
||
# VCS CONFIG | ||
vcs: %%vcs%% | ||
vcs: | ||
name: %%vcs%% | ||
main-branch: %%main-branch%% | ||
|
||
# PREREQUISITES | ||
# Actions executed before any questions get asked to the user. | ||
|
@@ -24,8 +26,8 @@ _default: | |
ask-confirmation: true | ||
|
||
# BRANCH SPECIFIC CONFIG | ||
# On master, we override the general config | ||
master: | ||
# On main, we override the general config | ||
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. Please also use the |
||
%%main-branch%%: | ||
version-generator: %%generator%% | ||
version-persister: | ||
vcs-tag: | ||
|
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.
Please keep this for your local git ignore