Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: migrated to new github pages deploy solution
- Loading branch information
Showing
5 changed files
with
179 additions
and
8 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,43 @@ | ||
const ghpages = require('gh-pages'); | ||
const Git = require('gh-pages/lib/git'); | ||
const parse = require('parse-github-url'); | ||
|
||
const git = new Git(process.cwd(), 'git'); | ||
const metadata = require('../package.json'); | ||
|
||
const main = async () => { | ||
try { | ||
console.log('Determining origin url'); | ||
const origin = await git.getRemoteUrl('origin'); | ||
|
||
const { host, repo } = parse(origin); | ||
const url = `https://${process.env.GITHUB_TOKEN}@${host}/${repo}`; | ||
|
||
console.log(`Publishing documentation to ${url} gh-pages branch`); | ||
await new Promise((resolve, reject) => { | ||
ghpages.publish( | ||
'dist', | ||
{ | ||
repo: url, | ||
message: `chore(release): documentation v${metadata.version}`, | ||
}, | ||
err => { | ||
if (err) reject(err); | ||
resolve(); | ||
}, | ||
); | ||
}); | ||
} catch (err) { | ||
console.error(err); | ||
throw err; | ||
} | ||
}; | ||
|
||
main() | ||
.then(() => { | ||
console.log(`Sucessfully published documentation to GitHub Pages`); | ||
}) | ||
.catch(() => { | ||
console.error(`Failed to publish documentation to GitHub Pages`); | ||
process.exit(1); | ||
}); |
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