diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 68ae3f092e5507b272d54c19412ca969b57952d6..6fe78b66cdb13821e8716674f6ab14c840910a51 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ variables: include: - project: 'hive/common-ci-configuration' - ref: fae6329387a55aee40c3760a9af95a7705644bf0 + ref: 0c9ee69b5b0d65ada0148f3da0f3469d52c9bd1e file: - '/templates/npm_projects.gitlab-ci.yml' @@ -25,6 +25,13 @@ lint: script: - npm run lint-ci +supplement_documentation_url: + stage: .pre + extends: .npm_generate_doc_url + variables: + REPLACE_ENV_NAME: "GEN_DOC_URL" + REPLACE_FILE_PATH: "${CI_PROJECT_DIR}/README.md" + build: stage: build extends: .npm_build_template @@ -32,32 +39,25 @@ build: DIST_DIR: "$CI_PROJECT_DIR/dist" NPM_PACKAGE_SCOPE: "@hiveio" NPM_PACKAGE_NAME: "workerbee" - artifacts: - paths: - - "${DIST_DIR}/*.tgz" - - when: always - expire_in: 1 week needs: - job: lint + - job: supplement_documentation_url + artifacts: true +# Generates documentation and supplements wiki URL so it is available in Wiki and published package README generate_docs: stage: build - extends: .npm_process_built_package_tarball + extends: .npm_based_job_base variables: DIST_DIR: "$CI_PROJECT_DIR/dist" - PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}" script: - scripts/generate_api_docs.sh "${CI_PROJECT_URL}" "${CI_COMMIT_SHA}" - needs: - - job: build + - job: supplement_documentation_url artifacts: true - artifacts: paths: - "${DIST_DIR}/docs" - when: always expire_in: 1 week @@ -74,6 +74,7 @@ push_to_wiki: extends: .npm_push_doc_template stage: deploy variables: + PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}" WIKI_PUSH_TOKEN: "$WIKI_PUSH_TOKEN" DIST_DIR: "$CI_PROJECT_DIR/dist" @@ -81,41 +82,6 @@ push_to_wiki: - job: generate_docs artifacts: true -supplement_documentation_url: - extends: .npm_process_built_package_tarball - stage: deploy - needs: - - job: build - artifacts: true - - job: push_to_wiki - artifacts: true - - variables: - PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}" - DIST_DIR: "$CI_PROJECT_DIR/dist" - - script: - - | - set -xe - cd "${SOURCE_DIR}" - echo "Attempting to replace generated documentation url placeholder: "${GEN_DOC_URL}"" - sed -i "s<\${GEN_DOC_URL}<${GEN_DOC_URL}<g" README.md - if grep -q "\${GEN_DOC_URL}" README.md; then exit 1; fi # Ensure that the placeholder was replaced - pnpm pack --pack-destination "${DIST_DIR}" --json > ""${DIST_DIR}/built_package_info.json" # repack to include updated README in final package - BUILT_PACKAGE_NAME=$(jq -r .[].filename "${DIST_DIR}/built_package_info.json") - echo BUILT_PACKAGE_PATH="${DIST_DIR}/${BUILT_PACKAGE_NAME}" > built_package_info.env - - artifacts: - reports: - dotenv: - - "${SOURCE_DIR}/built_package_info.env" # contains path to produced tgz - - paths: - - "${DIST_DIR}/*.tgz" # Built package - - when: always - expire_in: 1 week - deploy_dev_package: stage: deploy extends: .npm_deploy_package_template @@ -123,9 +89,9 @@ deploy_dev_package: PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}" NPM_PACKAGE_SCOPE: "@hiveio" needs: - - job: lint - job: test - - job: supplement_documentation_url + - job: push_to_wiki + - job: build artifacts: true deploy_production_public_npm: @@ -140,7 +106,8 @@ deploy_production_public_npm: NPM_PROVENANCE_ENABLE: "0" # XXX: Temporarly disable as it is not working - we have to find a way to get it working PACKAGE_TGZ_PATH: "${BUILT_PACKAGE_PATH}" needs: - - job: lint + - job: deploy_dev_package - job: test - - job: supplement_documentation_url + - job: push_to_wiki + - job: build artifacts: true diff --git a/npm-common-config b/npm-common-config index 809760aa908707f808b3d49a916e8c7260672cf6..0c9ee69b5b0d65ada0148f3da0f3469d52c9bd1e 160000 --- a/npm-common-config +++ b/npm-common-config @@ -1 +1 @@ -Subproject commit 809760aa908707f808b3d49a916e8c7260672cf6 +Subproject commit 0c9ee69b5b0d65ada0148f3da0f3469d52c9bd1e