diff options
author | Fabio Berger <me@fabioberger.com> | 2019-01-11 23:50:41 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2019-01-11 23:50:41 +0800 |
commit | 55ce0d9d1782257968c825b936c44084dcc140aa (patch) | |
tree | 2c706a6ab010b870015966b582c18bc8b6ba2b78 /packages/monorepo-scripts/src | |
parent | 895460aea329d8bb8a289297403be0a0c4b5a65b (diff) | |
download | dexon-0x-contracts-55ce0d9d1782257968c825b936c44084dcc140aa.tar.gz dexon-0x-contracts-55ce0d9d1782257968c825b936c44084dcc140aa.tar.zst dexon-0x-contracts-55ce0d9d1782257968c825b936c44084dcc140aa.zip |
Add pre-publish check to ensure publisher is logged in to docker cmdline
Diffstat (limited to 'packages/monorepo-scripts/src')
-rw-r--r-- | packages/monorepo-scripts/src/prepublish_checks.ts | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/packages/monorepo-scripts/src/prepublish_checks.ts b/packages/monorepo-scripts/src/prepublish_checks.ts index 82eaf5cf9..61ac76823 100644 --- a/packages/monorepo-scripts/src/prepublish_checks.ts +++ b/packages/monorepo-scripts/src/prepublish_checks.ts @@ -17,6 +17,18 @@ async function prepublishChecksAsync(): Promise<void> { await checkChangelogFormatAsync(updatedPublicPackages); await checkGitTagsForNextVersionAndDeleteIfExistAsync(updatedPublicPackages); await checkPublishRequiredSetupAsync(); + await checkDockerHubSetupAsync(); +} + +async function checkDockerHubSetupAsync(): Promise<void> { + try { + utils.log('Checking that the user is logged in to docker command...'); + await execAsync(`echo "$DOCKER_PASS" | docker login -u $DOCKER_USERNAME --password-stdin`); + } catch (err) { + throw new Error( + 'Failed to log you into the `docker` commandline tool. Make sure you have environment variables `DOCKER_USERNAME` and `DOCKER_PASS` set.', + ); + } } async function checkGitTagsForNextVersionAndDeleteIfExistAsync(updatedPublicPackages: Package[]): Promise<void> { |