From 8adfb49eddb86de41b53232bd11060a22d15fb02 Mon Sep 17 00:00:00 2001 From: Alvin Yim Date: Fri, 24 Sep 2021 14:52:27 +0930 Subject: [PATCH 1/4] Publish to SAGE NPM registry --- CHANGELOG.md | 4 ++++ bin/ci/prepare | 16 ++++++++++++++++ bin/ci/publish | 5 +++++ bin/deploy | 7 ------- bin/lib/publish | 8 ++++++++ bin/publish | 13 ------------- buildspec.yml | 5 +++-- package.json | 2 +- 8 files changed, 37 insertions(+), 23 deletions(-) create mode 100755 bin/ci/prepare create mode 100755 bin/ci/publish delete mode 100755 bin/deploy create mode 100755 bin/lib/publish delete mode 100755 bin/publish diff --git a/CHANGELOG.md b/CHANGELOG.md index 78e8f65..642f91a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # sqlit +## [Unreleased] +### Changed +- Publish to SAGE NPM registry. + ## [1.1.0] ### Changed - Skip mysqladmin on deploy. diff --git a/bin/ci/prepare b/bin/ci/prepare new file mode 100755 index 0000000..38a4913 --- /dev/null +++ b/bin/ci/prepare @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +set -e +set -x +cd "$(dirname "$0")/../.." + +main() { + sign_in_npm_registry +} + +sign_in_npm_registry() { + local path=//git.gotosage.com/api/v4/projects/513/packages/npm/ + echo "@tillit-do-scheduler:registry=https:$path" >> ~/.npmrc + echo "$path:_authToken=$NEXUS_TOKEN" >> ~/.npmrc +} + +main diff --git a/bin/ci/publish b/bin/ci/publish new file mode 100755 index 0000000..0c94d54 --- /dev/null +++ b/bin/ci/publish @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +set -e +set -x +cd "$(dirname "$0")/../.." +exec bin/yarn run exec bin/lib/publish diff --git a/bin/deploy b/bin/deploy deleted file mode 100755 index e8d2637..0000000 --- a/bin/deploy +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash -set -e -set -x -cd "$(dirname "$0")/.." - -bin/prepare -bin/yarn run exec bin/publish diff --git a/bin/lib/publish b/bin/lib/publish new file mode 100755 index 0000000..cfc2ce4 --- /dev/null +++ b/bin/lib/publish @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +set -e +set -x +cd "$(dirname "$0")/../.." +npx semver "$CODEBUILD_SOURCE_VERSION" || exit 0 +tsc +npm version --no-git-tag-version "$CODEBUILD_SOURCE_VERSION" +exec npm publish diff --git a/bin/publish b/bin/publish deleted file mode 100755 index 2b594b2..0000000 --- a/bin/publish +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash -set -e -set -x -cd "$(dirname "$0")/.." - -if [ -z "$VERSION" ]; then - >&2 echo VERSION is missing. - exit 1 -fi - -tsc -npm version --allow-same-version "$VERSION" -npm publish diff --git a/buildspec.yml b/buildspec.yml index 97cbc2c..22fee73 100644 --- a/buildspec.yml +++ b/buildspec.yml @@ -2,10 +2,11 @@ version: 0.2 phases: install: runtime-versions: - docker: 18 - nodejs: 10 + nodejs: 12 commands: + - bin/ci/prepare - bin/prepare build: commands: - bin/test + - bin/ci/publish diff --git a/package.json b/package.json index e115f69..e3e9c9a 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "@ailytic/sqlit", + "name": "@tillit-do-scheduler/sqlit", "version": "0.0.0", "description": "Sqlit - A library that makes database access easy and fun", "main": "./dist/index.js", From 04e74791092ffd78a555584ec1d02a3d65357e44 Mon Sep 17 00:00:00 2001 From: Alvin Yim Date: Fri, 24 Sep 2021 17:52:43 +0930 Subject: [PATCH 2/4] Remove the old Nexus logic --- bin/prepare | 8 -------- 1 file changed, 8 deletions(-) diff --git a/bin/prepare b/bin/prepare index bede7e3..eead8ca 100755 --- a/bin/prepare +++ b/bin/prepare @@ -7,7 +7,6 @@ main() { install_mysqldump check_requirements copy_env_sh - sign_in_nexus install_npm_packages setup_mysql } @@ -22,13 +21,6 @@ copy_env_sh() { cp -v env.sh{.example,} } -sign_in_nexus() { - [ -n "$CODEBUILD_BUILD_ID" ] || return 0 - [ -n "$VERSION" ] || return 0 - echo @ailytic:registry=http://nexus.dev.ailytic.com:8081/repository/ailytic-npm-hosted/ >> ~/.npmrc - echo "//nexus.dev.ailytic.com:8081/repository/ailytic-npm-hosted/:_authToken=NpmToken.$NEXUS_TOKEN" >> ~/.npmrc -} - install_npm_packages() { bin/yarn --frozen-lockfile } From 3684fc907d73fe091a52066a0fdae322fb0068ed Mon Sep 17 00:00:00 2001 From: Alvin Yim Date: Mon, 27 Sep 2021 12:42:22 +0930 Subject: [PATCH 3/4] Sign into Docker in CI --- bin/ci/prepare | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bin/ci/prepare b/bin/ci/prepare index 38a4913..508613a 100755 --- a/bin/ci/prepare +++ b/bin/ci/prepare @@ -5,6 +5,7 @@ cd "$(dirname "$0")/../.." main() { sign_in_npm_registry + sign_in_docker } sign_in_npm_registry() { @@ -13,4 +14,8 @@ sign_in_npm_registry() { echo "$path:_authToken=$NEXUS_TOKEN" >> ~/.npmrc } +sign_in_docker() { + echo "$DOCKER_PASSWORD" | docker login "-u$DOCKER_USER" --password-stdin +} + main From fc4e020e69076bac2275b49ef48529a8e8ab4a60 Mon Sep 17 00:00:00 2001 From: Alvin Yim Date: Mon, 27 Sep 2021 16:35:08 +0930 Subject: [PATCH 4/4] Dedup --- yarn.lock | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/yarn.lock b/yarn.lock index bc81716..2c63603 100644 --- a/yarn.lock +++ b/yarn.lock @@ -30,12 +30,7 @@ dependencies: "@types/node" "*" -"@types/node@*": - version "12.12.17" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.12.17.tgz#191b71e7f4c325ee0fb23bc4a996477d92b8c39b" - integrity sha512-Is+l3mcHvs47sKy+afn2O1rV4ldZFU7W8101cNlOd+MRbjM4Onida8jSZnJdTe/0Pcf25g9BNIUsuugmE6puHA== - -"@types/node@^9.4.7": +"@types/node@*", "@types/node@^9.4.7": version "9.6.55" resolved "https://registry.yarnpkg.com/@types/node/-/node-9.6.55.tgz#7cc1358c9c18e71f6c020e410962971863232cf5" integrity sha512-e/5tg8Ok0gSrN6pvHphnwTK0/CD9VPZrtZqpvvpEFAtfs+ZntusgGaWkf2lSEq1OFe2EDPeUMiMVpy4nZpJ4AQ== @@ -1136,16 +1131,11 @@ extglob@^2.0.4: snapdragon "^0.8.1" to-regex "^3.0.1" -extsprintf@1.3.0: +extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" integrity sha1-lpGEQOMEGnpBT4xS48V06zw+HgU= -extsprintf@^1.2.0: - version "1.4.0" - resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.4.0.tgz#e2689f8f356fad62cca65a3a91c5df5f9551692f" - integrity sha1-4mifjzVvrWLMplo6kcXfX5VRaS8= - fast-deep-equal@^2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz#7b05218ddf9667bf7f370bf7fdb2cb15fdd0aa49" @@ -2638,7 +2628,7 @@ minimatch@^3.0.2, minimatch@^3.0.3, minimatch@^3.0.4: dependencies: brace-expansion "^1.1.7" -minimist@0.0.8: +minimist@0.0.8, minimist@~0.0.1: version "0.0.8" resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.8.tgz#857fcabfc3397d2625b8228262e86aa7a011b05d" integrity sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0= @@ -2648,11 +2638,6 @@ minimist@^1.1.0, minimist@^1.1.1, minimist@^1.2.0: resolved "https://registry.yarnpkg.com/minimist/-/minimist-1.2.0.tgz#a35008b20f41383eec1fb914f4cd5df79a264284" integrity sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ= -minimist@~0.0.1: - version "0.0.10" - resolved "https://registry.yarnpkg.com/minimist/-/minimist-0.0.10.tgz#de3f98543dbf96082be48ad1a0c7cda836301dcf" - integrity sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8= - minipass@^2.6.0, minipass@^2.8.6, minipass@^2.9.0: version "2.9.0" resolved "https://registry.yarnpkg.com/minipass/-/minipass-2.9.0.tgz#e713762e7d3e32fed803115cf93e04bca9fcc9a6" @@ -3462,16 +3447,11 @@ rsvp@^3.3.3: resolved "https://registry.yarnpkg.com/rsvp/-/rsvp-3.6.2.tgz#2e96491599a96cde1b515d5674a8f7a91452926a" integrity sha512-OfWGQTb9vnwRjwtA2QwpG2ICclHC3pgXZO5xt8H2EfgDquO0qVdSb5T88L4qJVAEugbS56pAuV4XZM58UX8ulw== -safe-buffer@5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: +safe-buffer@5.1.2, safe-buffer@^5.0.1, safe-buffer@^5.1.2, safe-buffer@~5.1.0, safe-buffer@~5.1.1: version "5.1.2" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.1.2.tgz#991ec69d296e0313747d59bdfd2b745c35f8828d" integrity sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g== -safe-buffer@^5.0.1, safe-buffer@^5.1.2: - version "5.2.0" - resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.0.tgz#b74daec49b1148f88c64b68d49b1e815c1f2f519" - integrity sha512-fZEwUGbVl7kouZs1jCdMLdt95hdIv0ZeHg6L7qPeciMZhZ+/gdesW4wgTARkrFWEpspjEATAzUGPG8N2jJiwbg== - safe-regex@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/safe-regex/-/safe-regex-1.1.0.tgz#40a3669f3b077d1e943d44629e157dd48023bf2e" @@ -3902,15 +3882,7 @@ to-regex@^3.0.1, to-regex@^3.0.2: regex-not "^1.0.2" safe-regex "^1.1.0" -tough-cookie@^2.3.3, tough-cookie@^2.3.4: - version "2.5.0" - resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.5.0.tgz#cd9fb2a0aa1d5a12b473bd9fb96fa3dcff65ade2" - integrity sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g== - dependencies: - psl "^1.1.28" - punycode "^2.1.1" - -tough-cookie@~2.4.3: +tough-cookie@^2.3.3, tough-cookie@^2.3.4, tough-cookie@~2.4.3: version "2.4.3" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-2.4.3.tgz#53f36da3f47783b0925afa06ff9f3b165280f781" integrity sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==