Skip to content

Commit 4353c61

Browse files
committed
[added] document site releasing
1 parent e9d8e4e commit 4353c61

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,37 @@ including `bower` publishing, for you - automatically.
3535
_Initial idea is got from `React-Bootstrap` release tools `./tools/release`,
3636
that have been written by [Matt Smith @mtscout6](https://github.com/mtscout6)_
3737

38+
#### Publishing of built documents static pages
39+
40+
If your project compiles static documentation pages (as e.g. `React-Boostrap` does)
41+
and needs to publish them to standalone repo / hosting (via `git push`),
42+
you can do it the same way the `bower` package releasing done.
43+
44+
Just create additional github repo for your static documents site.
45+
46+
E.g. [react-bootstrap.github.io.git](https://github.com/react-bootstrap/react-bootstrap.github.io)
47+
48+
Add it as `'release-script'.docsRepo` into your `package.json`:
49+
```js
50+
"release-script": {
51+
"docsRepo": "[email protected]:<author>/original-project-name-github.io.git"
52+
}
53+
```
54+
Default folders for documents are:
55+
- `"docsRoot": "docs-built"` folder where the documents files will be built (by your custom building scripts)
56+
- `"tmpDocsRepo": "tmp-docs-repo"` temporary folder.
57+
58+
It is advised to add them both into `.gitignore`.
59+
60+
You can customize them as you need:
61+
```js
62+
"release-script": {
63+
"docsRepo": "[email protected]:<author>/original-project-name-github.io.git"
64+
"docsRoot": "docs-built",
65+
"tmpDocsRepo": "tmp-docs-repo"
66+
}
67+
```
68+
3869
#### Pre-release versions publishing
3970

4071
Say you need to publish pre-release `v0.25.100-pre.0` version
@@ -136,6 +167,8 @@ You can set a custom message for release via `--notes` CLI option:
136167
- then by `git add -A .` adds all bower distr files to the temporary git repo
137168
- commits, tags and pushes the same as for the `npm` package.
138169
- then deletes the `tmpBowerRepo` folder
170+
- id `docsRepo` field is present in the `package.json`, then it pushes builded documents to their repo.
171+
It is done the same way as `bower` repo.
139172

140173
## Installation
141174

src/release.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ const bowerRoot = path.join(repoRoot, (configOptions.bowerRoot || 'amd/'));
3939
const tmpBowerRepo = path.join(repoRoot, (configOptions.tmpBowerRepo || 'tmp-bower-repo'));
4040
const bowerRepo = configOptions.bowerRepo; // if it is not set, then there is no bower repo
4141

42+
const docsRoot = path.join(repoRoot, (configOptions.docsRoot || 'docs-built/'));
43+
const tmpDocsRepo = path.join(repoRoot, (configOptions.tmpDocsRepo || 'tmp-docs-repo'));
44+
const docsRepo = configOptions.docsRepo; // if it is not set, then there is no docs/site repo
45+
4246
const githubToken = process.env.GITHUB_TOKEN;
4347

4448
const altPkgRootFolder = configOptions.altPkgRootFolder;
@@ -327,6 +331,13 @@ function release({ type, preid, npmTagName }) {
327331
console.log('The "bowerRepo" is not set in package.json. Not publishing bower.'.yellow);
328332
}
329333

334+
// documents site
335+
if (!isPrivate && docsRepo) {
336+
console.log('Releasing: '.cyan + 'documents site'.green);
337+
releaseAdRepo(docsRepo, docsRoot, tmpDocsRepo, vVersion);
338+
console.log('Documents site has been released'.green);
339+
}
340+
330341
console.log('Version '.cyan + `v${newVersion}`.green + ' released!'.cyan);
331342
}
332343

0 commit comments

Comments
 (0)