Add 'make sync' for my convenience

This commit is contained in:
Radon Rosborough 2021-01-01 12:13:59 -08:00
parent 87d7e6df8a
commit 86c29aef4c
3 changed files with 21 additions and 7 deletions

View File

@ -151,12 +151,16 @@ download:
mkdir -p $(BUILD) mkdir -p $(BUILD)
aws s3 cp $(S3_DEB) $(BUILD)/$(DEB) aws s3 cp $(S3_DEB) $(BUILD)/$(DEB)
### Publish artifacts to registries
.PHONY: plan .PHONY: plan
plan: plan:
node tools/plan-publish.js node tools/plan-publish.js
.PHONY: sync
sync:
node tools/plan-publish.js --execute
### Publish artifacts to registries
.PHONY: push .PHONY: push
push: push:
@: $${I} $${DOCKER_REPO} @: $${I} $${DOCKER_REPO}

View File

@ -175,7 +175,11 @@ function printTable(data, headers) {
// Parse command-line arguments, run main functionality, and exit. // Parse command-line arguments, run main functionality, and exit.
async function main() { async function main() {
const program = new Command(); 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("--show-all", "show also unchanged artifacts");
program.option( program.option(
"--omit-unneeded-downloads", "--omit-unneeded-downloads",
@ -212,7 +216,11 @@ async function main() {
} else if (local === desired && remote !== desired) { } else if (local === desired && remote !== desired) {
action = "publish local"; action = "publish local";
details = `${remote} => ${desired}`; details = `${remote} => ${desired}`;
func = upload; func = async () => {
if (program.publish) {
await upload();
}
};
couldPrune = false; couldPrune = false;
noop = false; noop = false;
} else { } else {
@ -224,7 +232,9 @@ async function main() {
} }
func = async () => { func = async () => {
await build(); await build();
await upload(); if (program.publish) {
await upload();
}
}; };
couldPrune = false; couldPrune = false;
noop = false; noop = false;
@ -283,7 +293,7 @@ async function main() {
console.log(); console.log();
} }
tableData = filteredTableData; tableData = filteredTableData;
if (program.publish) { if (program.execute) {
for (const { func } of tableData) { for (const { func } of tableData) {
await func(); await func();
} }

View File

@ -20,7 +20,7 @@ trap cleanup EXIT
make pull-base scripts 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" | tee "${tmpdir}/plan-publish.out"
if ! grep -F "plan-publish is tagging app image" "${tmpdir}/plan-publish.out"; then if ! grep -F "plan-publish is tagging app image" "${tmpdir}/plan-publish.out"; then