Upload translation files to Transifex via publish command [MAILPOET-855]
This commit is contained in:
10
README.md
10
README.md
@ -144,12 +144,16 @@ Finally , a `WP_TRANSIFEX_API_TOKEN` environment variable should be initialized
|
||||
|
||||
# Publish
|
||||
|
||||
Before you run a publishing command, you need to:
|
||||
The `publish` command currently does the following:
|
||||
* Pushes translations POT file to Transifex;
|
||||
* Publishes the release in SVN.
|
||||
|
||||
Before you run it, you need to:
|
||||
1. Ensure there is an up-to-date local copy of MailPoet SVN repository in `.mp_svn` directory by running `./do svn:checkout`.
|
||||
2. Have all your features merged in Git `master`, your `mailpoet.php` and `readme.txt` tagged with a new version.
|
||||
3. Run `./build.sh` to produce a `mailpoet.zip` distributable archive.
|
||||
|
||||
Everything's ready? Then run `./do svn:publish`.
|
||||
Everything's ready? Then run `./do publish`.
|
||||
If the job goes fine, you'll get a message like this:
|
||||
```
|
||||
Go to '.mp_svn' and run 'svn ci -m "Release 3.0.0-beta.9"' to publish the
|
||||
@ -157,4 +161,4 @@ release
|
||||
```
|
||||
It's quite literal: you can review the changes to be pushed and if you're satisfied, run the suggested command to finish the release publishing process.
|
||||
|
||||
If you're confident, execute `./do svn:publish --force` and your release will be published to the remote SVN repository without manual intervention (automatically). For easier authentication you might want to set `WP_SVN_USERNAME` and `WP_SVN_PASSWORD` environment variables.
|
||||
If you're confident, execute `./do publish --force` and your release will be published to the remote SVN repository without manual intervention (automatically). For easier authentication you might want to set `WP_SVN_USERNAME` and `WP_SVN_PASSWORD` environment variables.
|
||||
|
25
RoboFile.php
25
RoboFile.php
@ -104,10 +104,24 @@ class RoboFile extends \Robo\Tasks {
|
||||
);
|
||||
}
|
||||
|
||||
function pushpot() {
|
||||
return $this->collectionBuilder()
|
||||
->addCode(array($this, 'txinit'))
|
||||
->taskExec('tx push -s')
|
||||
->run();
|
||||
}
|
||||
|
||||
function packtranslations() {
|
||||
return $this->collectionBuilder()
|
||||
->addCode(array($this, 'txinit'))
|
||||
->taskExec('./tasks/pack_translations.sh')
|
||||
->run();
|
||||
}
|
||||
|
||||
function txinit() {
|
||||
// Define WP_TRANSIFEX_API_TOKEN env. variable
|
||||
$this->loadEnv();
|
||||
return $this->_exec('./tasks/pack_translations.sh');
|
||||
return $this->_exec('./tasks/transifex_init.sh');
|
||||
}
|
||||
|
||||
function testUnit($opts=['file' => null, 'xml' => false]) {
|
||||
@ -311,6 +325,15 @@ class RoboFile extends \Robo\Tasks {
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function publish($opts = ['force' => false]) {
|
||||
return $this->collectionBuilder()
|
||||
->addCode(array($this, 'pushpot'))
|
||||
->addCode(function () use ($opts) {
|
||||
return $this->svnPublish($opts);
|
||||
})
|
||||
->run();
|
||||
}
|
||||
|
||||
protected function loadEnv() {
|
||||
$dotenv = new Dotenv\Dotenv(__DIR__);
|
||||
$dotenv->load();
|
||||
|
@ -1,14 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Write .transifexrc file if not exists
|
||||
if [ ! -f ~/.transifexrc ]; then
|
||||
echo "[https://www.transifex.com]" > ~/.transifexrc
|
||||
echo "hostname = https://www.transifex.com" >> ~/.transifexrc
|
||||
echo "username = api" >> ~/.transifexrc
|
||||
echo "password = $WP_TRANSIFEX_API_TOKEN" >> ~/.transifexrc
|
||||
echo "token =" >> ~/.transifexrc
|
||||
fi
|
||||
|
||||
echo "Getting translations from Transifex..."
|
||||
tx pull -a -f
|
||||
|
||||
|
10
tasks/transifex_init.sh
Normal file
10
tasks/transifex_init.sh
Normal file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Write ~/.transifexrc file if not exists
|
||||
if [ ! -f ~/.transifexrc ]; then
|
||||
echo "[https://www.transifex.com]" > ~/.transifexrc
|
||||
echo "hostname = https://www.transifex.com" >> ~/.transifexrc
|
||||
echo "username = api" >> ~/.transifexrc
|
||||
echo "password = $WP_TRANSIFEX_API_TOKEN" >> ~/.transifexrc
|
||||
echo "token =" >> ~/.transifexrc
|
||||
fi
|
Reference in New Issue
Block a user