forked from akveo/nebular
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(ci): add deploy docs workflow (akveo#2950)
- Loading branch information
1 parent
303e708
commit 8171e0b
Showing
3 changed files
with
129 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Deploy docs | ||
on: | ||
push: | ||
branches: | ||
- master | ||
release: | ||
types: | ||
- published | ||
jobs: | ||
deploy-docs: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v2 | ||
with: | ||
node-version: '14' | ||
cache: 'npm' | ||
- run: npm ci | ||
- run: npm run docs:gh-pages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { promisify } from 'util'; | ||
import { exec } from 'child_process'; | ||
|
||
export interface GetStdoutOptions { | ||
cwd?: string; | ||
showLog?: boolean; | ||
} | ||
|
||
const DEFAULT_OPTIONS: GetStdoutOptions = { cwd: process.cwd(), showLog: false }; | ||
|
||
export async function getStdout(command: string, options?: GetStdoutOptions) { | ||
let { cwd, showLog } = Object.assign({}, DEFAULT_OPTIONS, options); | ||
|
||
try { | ||
console.log(`Reading stdout when running "${command}" in "${cwd}"`); | ||
const { stdout } = await promisify(exec)(command, { cwd }); | ||
|
||
if (showLog && stdout) { | ||
console.log(stdout); | ||
} | ||
|
||
return stdout; | ||
} catch ({ message, stdout }) { | ||
let errorMessage = `Error running "${command}" in "${cwd}": ${message}.`; | ||
if (stdout) { | ||
errorMessage += `\nstdout: ${stdout}`; | ||
console.error(stdout); | ||
} | ||
throw new Error(errorMessage); | ||
} | ||
} |