Skip to content
Snippets Groups Projects
Commit c89a6447 authored by Bartek Wrona's avatar Bartek Wrona
Browse files

dist-tag detection logic is based directly on informations provided by CI to...

dist-tag detection logic is based directly on informations provided by CI to eliminate branch detection ambiguities
parent 9fdeae2f
No related branches found
No related tags found
1 merge request!57Improvements in dist-tag detection rules to correctly publish NPM package
...@@ -41,7 +41,17 @@ variables: ...@@ -41,7 +41,17 @@ variables:
NPM_REGISTRY_URL: "gitlab.syncad.com/api/v4/projects/${CI_PROJECT_ID}/packages/npm/" NPM_REGISTRY_URL: "gitlab.syncad.com/api/v4/projects/${CI_PROJECT_ID}/packages/npm/"
script: script:
- /home/emscripten/scripts/npm_build_package.sh "${SOURCE_DIR}" "${NPM_REGISTRY_URL}" "${NPM_PACKAGE_SCOPE}" "${NPM_PACKAGE_NAME}" "${DIST_DIR}" - |
if [ "${CI_COMMIT_REF_PROTECTED}" == "true" ]; then
if [ -n "${CI_COMMIT_TAG}" ]; then
DIST_TAG="latest" # if package is built for protected tag, let's mark it as latest
else
DIST_TAG="stable" # otherwise, any build for protected branch will produce stable package
fi
else
DIST_TAG="dev"
fi
/home/emscripten/scripts/npm_build_package.sh "${SOURCE_DIR}" "${NPM_REGISTRY_URL}" "${NPM_PACKAGE_SCOPE}" "${NPM_PACKAGE_NAME}" "${DIST_DIR}" "${DIST_TAG}"
artifacts: artifacts:
reports: reports:
...@@ -131,7 +141,7 @@ variables: ...@@ -131,7 +141,7 @@ variables:
script: script:
# project version info must be regenerated accoring to correct target registry, package scope and name # project version info must be regenerated accoring to correct target registry, package scope and name
- /home/emscripten/scripts/npm_generate_version.sh "${SOURCE_DIR}" "registry.npmjs.org/" "@hiveio" "${NPM_PACKAGE_NAME}" - /home/emscripten/scripts/npm_generate_version.sh "${SOURCE_DIR}" "registry.npmjs.org/" "@hiveio" "${NPM_PACKAGE_NAME}" "latest"
- echo -e "\e[0Ksection_start:$(date +%s):publishing[collapsed=false]\r\e[0KAttempting to publish a package to registry.npmjs.org..." - echo -e "\e[0Ksection_start:$(date +%s):publishing[collapsed=false]\r\e[0KAttempting to publish a package to registry.npmjs.org..."
- /home/emscripten/scripts/npm_publish.sh "${SOURCE_DIR}" "registry.npmjs.org/" "@hiveio" "${NPM_PUBLISH_TOKEN}" - /home/emscripten/scripts/npm_publish.sh "${SOURCE_DIR}" "registry.npmjs.org/" "@hiveio" "${NPM_PUBLISH_TOKEN}"
- echo -e "\e[0Ksection_end:$(date +%s):publishing\r\e[0KDone" - echo -e "\e[0Ksection_end:$(date +%s):publishing\r\e[0KDone"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment