From 8197a6d39b6e7ab90aa0aebd57b7e13c47dbbb0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20L=C3=A9one?= Date: Wed, 3 Jun 2020 15:16:56 +0200 Subject: [PATCH] chore(release): add docker build and push from the release script (#1053) --- scripts/release/release.js | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/scripts/release/release.js b/scripts/release/release.js index 7dc2e9b54f..0d81d3da10 100644 --- a/scripts/release/release.js +++ b/scripts/release/release.js @@ -1,7 +1,7 @@ /****************************************************************************** * Scaleway CLI release script. * - * This script will trigger a release process for the scaleway Go SDK. + * This script will trigger a release process for the scaleway CLI. * * The script will proceed as follow: * - Create a new remote `scaleway-release` that points to main repo @@ -13,7 +13,7 @@ * - Ask to review changes * - Create a release PR on github * - Create a release - * - Build binary that should be upload on the github release with there SHA256SUM + * - Build binary that should be upload on the github release with their SHA256SUM * - Create a github release * - Attach compiled binary to the github release * - Update S3 version file @@ -85,9 +85,11 @@ const S3_DEVTOOL_BUCKET = "scw-devtools"; const S3_DEVTOOL_BUCKET_REGION = "nl-ams"; // S3 object name of the version file that should be updated during release. const S3_VERSION_OBJECT_NAME = "scw-cli-v2-version"; +// Name of the Docker image on hub.docker.com +const DOCKER_IMAGE_NAME = "scaleway/cli"; /* - * Usefull constant + * Useful constant */ const GITHUB_CLONE_URL = `git@github.com:${GITHUB_OWNER}/${GITHUB_REPO}.git`; const GITHUB_REPO_URL = `https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}`; @@ -123,6 +125,8 @@ async function main() { region: `${S3_DEVTOOL_BUCKET_REGION}`, }); + await prompt(`Make sure that your local Docker Daemon is logged on hub.docker.com AND that you can push to Scaleway's Docker organization.`.magenta); + // // Initialize TMP_REMOTE // @@ -244,6 +248,13 @@ async function main() { console.log(` Successfully updated s3 version file: https://${S3_DEVTOOL_BUCKET}.s3.${S3_DEVTOOL_BUCKET_REGION}.scw.cloud/${S3_VERSION_OBJECT_NAME}`.green); await prompt(`Hit enter to continue .....`.magenta); + // + // Update Docker version + // + console.log("Build and push a container image".blue); + docker(`docker build -t scaleway/cli:v${newVersion} .`); + docker(`docker push scaleway/cli:v${newVersion}`); + // // Creating post release commit // @@ -287,6 +298,10 @@ function git(...args) { return exec("git", ...args) } +function docker(...args) { + return exec("docker", ...args) +} + function exec(cmd, ...args) { console.log(` ${cmd} ${args.join(" ")}`.grey); const { stdout, status, stderr } = spawnSync(cmd, args, { encoding: "utf8" });