Skip to content

Commit

Permalink
chore(release): add docker build and push from the release script (sc…
Browse files Browse the repository at this point in the history
  • Loading branch information
remyleone authored Jun 3, 2020
1 parent e641226 commit 8197a6d
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions scripts/release/release.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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 = `[email protected]:${GITHUB_OWNER}/${GITHUB_REPO}.git`;
const GITHUB_REPO_URL = `https://github.com/${GITHUB_OWNER}/${GITHUB_REPO}`;
Expand Down Expand Up @@ -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
//
Expand Down Expand Up @@ -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
//
Expand Down Expand Up @@ -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" });
Expand Down

0 comments on commit 8197a6d

Please sign in to comment.