js-waku/ci/deploy.js
Danish Arora 87717981eb
chore: upgrade libp2p and related deps (#1482)
* chore: update noise

* update: package.lock

* update: @chainsafe/libp2p-gossipsub

* rm unwanted libp2p interface deps & bump up libp2p

* refactor code for new deps

* update: new package.lock

* setup prettier, refactor eslint  and rm trailing commas

* update package.lock

* fix build

* import type for interface

* fix imports for merge

* update typedoc exports

* add: CustomEvent import

* use new libp2p interface

* add aegir as dev dep for tests
2023-08-16 20:18:13 +05:30

46 lines
1.0 KiB
JavaScript

import { promisify } from "util";
import { publish } from "gh-pages";
/* fix for "Unhandled promise rejections" */
process.on("unhandledRejection", (err) => {
throw err;
});
const ghpublish = promisify(publish);
const Args = process.argv.slice(2);
const USE_HTTPS = Args[0] && Args[0].toUpperCase() === "HTTPS";
const branch = "gh-pages";
const org = "waku-org";
const repo = "js-waku";
/* use SSH auth by default */
let repoUrl = USE_HTTPS
? `https://github.com/${org}/${repo}.git`
: `git@github.com:${org}/${repo}.git`;
/* alternative auth using GitHub user and API token */
if (typeof process.env.GH_USER !== "undefined") {
repoUrl =
"https://" +
process.env.GH_USER +
":" +
process.env.GH_TOKEN +
"@" +
`github.com/${org}/${repo}.git`;
}
const main = async (url, branch) => {
console.log(`Pushing to: ${url}`);
console.log(`On branch: ${branch}`);
await ghpublish("docs", {
repo: url,
branch: branch,
dotfiles: true,
silent: false
});
};
void main(repoUrl, branch);