From 86c29aef4c39e628d2933e1eb55bbaf00c3d6c46 Mon Sep 17 00:00:00 2001 From: Radon Rosborough Date: Fri, 1 Jan 2021 12:13:59 -0800 Subject: [PATCH] Add 'make sync' for my convenience --- Makefile | 8 ++++++-- tools/plan-publish.js | 18 ++++++++++++++---- tools/publish.bash | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index 87ea309..fc52df4 100644 --- a/Makefile +++ b/Makefile @@ -151,12 +151,16 @@ download: mkdir -p $(BUILD) aws s3 cp $(S3_DEB) $(BUILD)/$(DEB) -### Publish artifacts to registries - .PHONY: plan plan: node tools/plan-publish.js +.PHONY: sync +sync: + node tools/plan-publish.js --execute + +### Publish artifacts to registries + .PHONY: push push: @: $${I} $${DOCKER_REPO} diff --git a/tools/plan-publish.js b/tools/plan-publish.js index ff872cd..9ca4caf 100644 --- a/tools/plan-publish.js +++ b/tools/plan-publish.js @@ -175,7 +175,11 @@ function printTable(data, headers) { // Parse command-line arguments, run main functionality, and exit. async function main() { const program = new Command(); - program.option("--publish", "deploy newly built artifacts"); + program.option("--execute", "pull and build artifacts locally"); + program.option( + "--publish", + "with --execute, also deploy newly built artifacts" + ); program.option("--show-all", "show also unchanged artifacts"); program.option( "--omit-unneeded-downloads", @@ -212,7 +216,11 @@ async function main() { } else if (local === desired && remote !== desired) { action = "publish local"; details = `${remote} => ${desired}`; - func = upload; + func = async () => { + if (program.publish) { + await upload(); + } + }; couldPrune = false; noop = false; } else { @@ -224,7 +232,9 @@ async function main() { } func = async () => { await build(); - await upload(); + if (program.publish) { + await upload(); + } }; couldPrune = false; noop = false; @@ -283,7 +293,7 @@ async function main() { console.log(); } tableData = filteredTableData; - if (program.publish) { + if (program.execute) { for (const { func } of tableData) { await func(); } diff --git a/tools/publish.bash b/tools/publish.bash index 9e7f794..ba196af 100755 --- a/tools/publish.bash +++ b/tools/publish.bash @@ -20,7 +20,7 @@ trap cleanup EXIT make pull-base scripts -node tools/plan-publish.js --publish --show-all --omit-unneeded-downloads \ +node tools/plan-publish.js --execute --publish --show-all --omit-unneeded-downloads \ | tee "${tmpdir}/plan-publish.out" if ! grep -F "plan-publish is tagging app image" "${tmpdir}/plan-publish.out"; then