From a4d57e62f8285994d38eee16132c136d7b3436ee Mon Sep 17 00:00:00 2001 From: Maurizio Cacace Date: Tue, 14 Mar 2023 14:18:43 +0100 Subject: [PATCH] AAE-11622 - remove unused scripts from pipeline (#8329) * AAE-11622 remove unused scripts * AAE-11622 remove unused scripts * AAE-11622 remove unused scripts * AAE-11622 remove unused scripts --- scripts/ci/check-env/check-cs-env.sh | 9 - scripts/ci/check-env/check-external-cs-env.sh | 9 - scripts/ci/check-env/check-ps-cloud-env.sh | 9 - scripts/ci/check-env/check-ps-env.sh | 9 - scripts/ci/job_hooks/after_e2e.sh | 5 - scripts/ci/job_hooks/before_e2e.sh | 11 - scripts/ci/job_hooks/before_install.sh | 98 ------- scripts/ci/job_hooks/install.sh | 15 -- scripts/ci/jobs/dbpci-before-playwright | 4 - scripts/ci/jobs/dbpci-build-guard-check | 56 ---- scripts/ci/partials/_ci-flags-parser.sh | 35 --- scripts/ci/utils/artifact-from-s3.sh | 38 --- scripts/ci/utils/artifact-to-s3.sh | 27 -- scripts/github/build/bumpversion.sh | 14 - .../storybook-testing/storybook-test.sh | 7 - .../github/update/adf-same-commit-verify.js | 71 ----- scripts/npm-move-tag.sh | 44 ---- scripts/pre-publish.js | 22 -- scripts/release.sh | 64 ----- scripts/update-version.sh | 242 ------------------ 20 files changed, 789 deletions(-) delete mode 100755 scripts/ci/check-env/check-cs-env.sh delete mode 100755 scripts/ci/check-env/check-external-cs-env.sh delete mode 100755 scripts/ci/check-env/check-ps-cloud-env.sh delete mode 100755 scripts/ci/check-env/check-ps-env.sh delete mode 100755 scripts/ci/job_hooks/after_e2e.sh delete mode 100755 scripts/ci/job_hooks/before_e2e.sh delete mode 100755 scripts/ci/job_hooks/before_install.sh delete mode 100755 scripts/ci/job_hooks/install.sh delete mode 100755 scripts/ci/jobs/dbpci-before-playwright delete mode 100755 scripts/ci/jobs/dbpci-build-guard-check delete mode 100644 scripts/ci/partials/_ci-flags-parser.sh delete mode 100755 scripts/ci/utils/artifact-from-s3.sh delete mode 100755 scripts/ci/utils/artifact-to-s3.sh delete mode 100755 scripts/github/build/bumpversion.sh delete mode 100755 scripts/github/storybook-testing/storybook-test.sh delete mode 100644 scripts/github/update/adf-same-commit-verify.js delete mode 100755 scripts/npm-move-tag.sh delete mode 100644 scripts/pre-publish.js delete mode 100755 scripts/release.sh delete mode 100755 scripts/update-version.sh diff --git a/scripts/ci/check-env/check-cs-env.sh b/scripts/ci/check-env/check-cs-env.sh deleted file mode 100755 index 6b0ebfc940..0000000000 --- a/scripts/ci/check-env/check-cs-env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -cd $DIR/../../../ - -echo "====== Check content UP =====" - -./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 diff --git a/scripts/ci/check-env/check-external-cs-env.sh b/scripts/ci/check-env/check-external-cs-env.sh deleted file mode 100755 index e2e6bcd6ab..0000000000 --- a/scripts/ci/check-env/check-external-cs-env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -cd $DIR/../../../ - -echo "====== Check External ACS is UP =====" - -./node_modules/@alfresco/adf-cli/bin/adf-cli check-cs-env --host "$EXTERNAL_ACS_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" || exit 1 diff --git a/scripts/ci/check-env/check-ps-cloud-env.sh b/scripts/ci/check-env/check-ps-cloud-env.sh deleted file mode 100755 index e59b061257..0000000000 --- a/scripts/ci/check-env/check-ps-cloud-env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -cd $DIR/../../../ - -echo "====== Check PS Cloud UP =====" - -./node_modules/@alfresco/adf-cli/bin/adf-cli init-aae-env --oauth "$E2E_HOST" --host "$E2E_HOST_APA" --modelerUsername "$E2E_MODELER_USERNAME" --modelerPassword "$E2E_MODELER_PASSWORD" --devopsUsername "$E2E_DEVOPS_USERNAME" --devopsPassword "$E2E_DEVOPS_PASSWORD" --clientId 'alfresco' || exit 1 diff --git a/scripts/ci/check-env/check-ps-env.sh b/scripts/ci/check-env/check-ps-env.sh deleted file mode 100755 index 891ae465af..0000000000 --- a/scripts/ci/check-env/check-ps-env.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -cd $DIR/../../../ - -echo "====== Check PS UP =====" - -./node_modules/@alfresco/adf-cli/bin/adf-cli init-aps-env --host "$E2E_HOST" -u "$E2E_USERNAME" -p "$E2E_PASSWORD" --license "$AWS_S3_BUCKET_ACTIVITI_LICENSE" diff --git a/scripts/ci/job_hooks/after_e2e.sh b/scripts/ci/job_hooks/after_e2e.sh deleted file mode 100755 index 5f05f01089..0000000000 --- a/scripts/ci/job_hooks/after_e2e.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -# Upload protractor-smartrunner artifact related to this particular job to S3 -./scripts/ci/utils/artifact-to-s3.sh -a "$SMART_RUNNER_DIRECTORY" -o "$S3_SMART_RUNNER_PATH/$JOB_ID.tar.bz2" - diff --git a/scripts/ci/job_hooks/before_e2e.sh b/scripts/ci/job_hooks/before_e2e.sh deleted file mode 100755 index dc6fc72467..0000000000 --- a/scripts/ci/job_hooks/before_e2e.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/usr/bin/env bash - - # Download protractor-smartrunner artifact related to this particular job from S3, if exists -./scripts/ci/utils/artifact-from-s3.sh -a "$S3_SMART_RUNNER_PATH/$JOB_ID.tar.bz2" -o "$SMART_RUNNER_DIRECTORY" - -# The adf-testing is not installed through NPM for this reason it needs to be built -# in addition the dist folder needs to be moved as part of the node modules -# in this way the protractor.config.js can use require('@alfresco/adf-testing'); -nx run testing:bundle - -exit 0 diff --git a/scripts/ci/job_hooks/before_install.sh b/scripts/ci/job_hooks/before_install.sh deleted file mode 100755 index 736260eef6..0000000000 --- a/scripts/ci/job_hooks/before_install.sh +++ /dev/null @@ -1,98 +0,0 @@ -#!/usr/bin/env bash - -# =================================================================== -# In this hook-file define only dynamic-ish environmental variables. -# Put the static environment variables into the env.yml file -# Command executions or any other installation logic -# is supposed to be in the "install.sh" hook script. -# =================================================================== -PARENT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )" -ENV_FILE=${1:-"/tmp/github_vars.env"} - -# Settings for protractor-smartrunner ------------------------------------------------- -export GIT_HASH=$(git rev-parse HEAD) - - -# Settings for Nx --------------------------------------------------------------------- -export BASE_HASH="$(git merge-base origin/"$GITHUB_BASE_REF" HEAD)" -export HEAD_HASH="HEAD" -export HEAD_COMMIT_HASH=${GH_COMMIT} -export COMMIT_MESSAGE=$(git log --format=%B -n 1 "$HEAD_COMMIT_HASH") - -######################################################################################### -# Settings based of Github event type -######################################################################################### -if [ "${GITHUB_EVENT_NAME}" == "push" ]; then - # Settings for merges --------------------------------------------------------------- - BRANCH=${GITHUB_REF##*/} - if [[ "$BRANCH" =~ ^master(-patch.*)?$ ]]; then - # into master(-patch*) - export NX_CALCULATION_FLAGS="--all" - export BUILD_OPTS="--configuration production" - elif [[ "$BRANCH" =~ ^develop-patch.*$ ]]; then - # into develop-patch* - echo -e "\e[32mSetting up CI jobs for patch version creation.\e[0m" - export NX_CALCULATION_FLAGS="--all" - export BUILD_OPTS="--configuration production" - else - # into develop - export NX_CALCULATION_FLAGS="--base=$(git describe --tags $(git rev-list --tags --max-count=1)) --head=$HEAD_HASH" - export BUILD_OPTS="--configuration production" - fi -elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then - # Settings for PRs ------------------------------------------------------------------ - export NX_CALCULATION_FLAGS="--base=origin/$GITHUB_BASE_REF --head=$HEAD_HASH" - export BUILD_OPTS="--configuration production" -elif [ "${GITHUB_EVENT_NAME}" == "schedule" ]; then - # Settings for Cron ----------------------------------------------------------------- - export NX_CALCULATION_FLAGS="--all" - export BUILD_OPTS="--configuration production" -else - # Settings for API ------------------------------------------------------------------ - export NX_CALCULATION_FLAGS="--all" - export BUILD_OPTS="--configuration production" -fi - -# Settings for S3 caching ------------------------------------------------------------- -pip install --user awscli - -if [ "${GITHUB_EVENT_NAME}" == "push" ]; then - echo "push" -elif [ "${GITHUB_EVENT_NAME}" == "pull_request" ]; then - echo "pull_request" - export BASE_HASH="origin/$GITHUB_BASE_REF" - source "$PARENT_DIR/partials/_ci-flags-parser.sh" -elif [ "${GITHUB_EVENT_NAME}" == "schedule" ]; then - echo "cron" -else - echo "api" -fi - -# Cache for protractor smart-runner -export S3_SMART_RUNNER_PATH="$S3_DBP_PATH/smart-runner/$BUILD_ID" - -# Cache for node_modules -export NODE_VERSION=$(node -v) -export PACKAGE_LOCK_SHASUM=$(shasum ./package-lock.json | cut -f 1 -d " ") -# This can change regardless of package-lock.json, so we need to calculate with this one as well -export S3_NODE_MODULES_CACHE_ID=$(echo "$NODE_VERSION-$PACKAGE_LOCK_SHASUM" | shasum | cut -f 1 -d " ") -export S3_NODE_MODULES_CACHE_PATH="$S3_DBP_PATH/cache/node_modules/$S3_NODE_MODULES_CACHE_ID.tar.bz2" - -echo "========== Caching settings ==========" -echo "S3_SMART_RUNNER_PATH=$S3_SMART_RUNNER_PATH" | tee -a $ENV_FILE -echo "PACKAGE_LOCK_SHASUM=$PACKAGE_LOCK_SHASUM" | tee -a $ENV_FILE -echo "NODE_VERSION=$NODE_VERSION" | tee -a $ENV_FILE -echo "S3_NODE_MODULES_CACHE_ID=$S3_NODE_MODULES_CACHE_ID" | tee -a $ENV_FILE -echo "S3_NODE_MODULES_CACHE_PATH=$S3_NODE_MODULES_CACHE_PATH" | tee -a $ENV_FILE -echo "========== Nx settings ==========" -echo "GIT_HASH=$GIT_HASH" | tee -a $ENV_FILE -echo "BASE_HASH=$BASE_HASH" | tee -a $ENV_FILE -echo "HEAD_HASH=$HEAD_HASH" | tee -a $ENV_FILE - - -echo "========== Build vars==========" -echo "BUILD_OPTS=$BUILD_OPTS" | tee -a $ENV_FILE -echo "NX_CALCULATION_FLAGS=$NX_CALCULATION_FLAGS" | tee -a $ENV_FILE -echo "HEAD_COMMIT_HASH=$HEAD_COMMIT_HASH" | tee -a $ENV_FILE -COMMIT_MESSAGE=$(echo "COMMIT_MESSAGE='${COMMIT_MESSAGE}'" | tr '*' '-' | tr '\n' ' ') -echo $COMMIT_MESSAGE | tee -a $ENV_FILE diff --git a/scripts/ci/job_hooks/install.sh b/scripts/ci/job_hooks/install.sh deleted file mode 100755 index 3b356ffb83..0000000000 --- a/scripts/ci/job_hooks/install.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/env bash - -npm ci -# the cli/testing need to be always build because they are now installed from NPM! -# nx build cli -# nx build testing -# The adf-cli is not installed through NPM for this reason it needs to be built -# in addition the dist folder needs to be moved as part of the node modules -# in this way every check like check-cs check-ps can use the adf cli -# the bundle is saved under node_modules also to use the same cache of github -nx run cli:bundle -# The adf-testing is not installed through NPM for this reason it needs to be built -# in addition the dist folder needs to be moved as part of the node modules -# in this way the protractor.config.js can use require('@alfresco/adf-testing'); -nx run testing:bundle diff --git a/scripts/ci/jobs/dbpci-before-playwright b/scripts/ci/jobs/dbpci-before-playwright deleted file mode 100755 index 9308503c86..0000000000 --- a/scripts/ci/jobs/dbpci-before-playwright +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env bash - -# At the moment we only need to install chromium -npx playwright install chromium diff --git a/scripts/ci/jobs/dbpci-build-guard-check b/scripts/ci/jobs/dbpci-build-guard-check deleted file mode 100755 index 46c4d390c1..0000000000 --- a/scripts/ci/jobs/dbpci-build-guard-check +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/env bash - -EXIT_STATUS_DRAFT=0 -EXIT_STATUS_APPROVAL=0 -PR_NUMBER=null - -if [ "${CI_FORCE_RUN}" == "true" ]; then - echo -e "\e[32mWarning: CI_FORCE_RUN has been set to true, CI run will continue.\e[0m" - exit 0; -fi - -APPROVAL_CHECK=true -VERBOSE=false -for var in "$@" -do - case "$var" in - --no-approval-check) APPROVAL_CHECK=false;; - --verbose) VERBOSE=true;; - *) PR_NUMBER=$var - esac -done - -echo -e "\e[33mFetching data from Github APi for PR: $PR_NUMBER\e[0m" - -PR_DATA=`curl \ - -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${GITHUB_TOKEN}" \ - https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/pulls/${PR_NUMBER}` -DRAFT=`echo ${PR_DATA} | jq .draft` - -if [ "${DRAFT}" == "false" ]; then - echo -e "\e[32mPR is NOT DRAFT anymore, build can proceed.\e[0m" -else - echo -e "\e[31mPR is DRAFT, build will stop.\e[0m" - EXIT_STATUS_DRAFT=1 -fi - -if [ "$APPROVAL_CHECK" == "true" ]; then - PR_REVIEW_DATA=`curl \ - -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${GITHUB_TOKEN}" \ - https://api.github.com/repos/${REPO_OWNER}/${REPO_NAME}/pulls/${PR_NUMBER}/reviews?per_page=100` - APPROVED=`echo ${PR_REVIEW_DATA} | jq 'map(select(.state == "APPROVED")) | any'` - - if [ "${APPROVED}" == "true" ]; then - echo -e "\e[32mPR is approved, build can proceed.\e[0m" - else - echo -e "\e[31mPR is NOT APPROVED yet, build will stop.\e[0m" - EXIT_STATUS_APPROVAL=1 - - fi -fi - -[[ "$VERBOSE" == "true" ]] && echo $PR_DATA | jq -[[ "$VERBOSE" == "true" ]] && echo $PR_REVIEW_DATA | jq - -EXIT_CODE=$(( $EXIT_STATUS_DRAFT + $EXIT_STATUS_APPROVAL )) -exit $EXIT_CODE diff --git a/scripts/ci/partials/_ci-flags-parser.sh b/scripts/ci/partials/_ci-flags-parser.sh deleted file mode 100644 index eb9f4212f7..0000000000 --- a/scripts/ci/partials/_ci-flags-parser.sh +++ /dev/null @@ -1,35 +0,0 @@ -# Note no #!/bin/sh as this should not spawn -# an extra shell, since this partial shell script -# is supposed to be invoked as part of another. - -# =========================================================================== -# Flag for overwrite the affected projects calculation -# =========================================================================== -# Usage: -# This flag is intended to be used only for debugging purposes!!! -# -# To run only a few projects, provide a valid list of comma separated projects -# git commit -m "[affected:project-name1,project-name2] you commit message" -# - -# --------------------------------------------------------------- -# Affected projects calculation -# --------------------------------------------------------------- -if [[ $COMMIT_MESSAGE == *"[affected:"* ]]; then - PROJECTS=$(echo "$COMMIT_MESSAGE" | grep -o "\[affected\:[^]]*\]" | sed -e 's#\[affected:##g' | sed -e 's#\]##g') - - if [[ $PROJECTS == "*" ]]; then - export NX_CALCULATION_FLAGS="--all" - fi -fi - -# --------------------------------------------------------------- -# Forced CI run -# --------------------------------------------------------------- -if [[ $COMMIT_MESSAGE == *"[ci:force]"* ]]; then - echo -e "\e[31mWarning: CI build is going to run regardless of its Draft and approval status. You must be a Jedi!\e[0m" - export CI_FORCE_RUN=true -else - export CI_FORCE_RUN=false -fi - diff --git a/scripts/ci/utils/artifact-from-s3.sh b/scripts/ci/utils/artifact-from-s3.sh deleted file mode 100755 index 9b25ee192f..0000000000 --- a/scripts/ci/utils/artifact-from-s3.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -show_help() { - echo "Usage: dbpci-artifact-from-s3 " - echo "" - echo "-a or --artifact [mandatory]: path to the s3 artifact (tar.bz2) to download and extract" - echo "-o or --output [mandatory]: directory to extract the archive to" -} - -while [[ $1 == -* ]]; do - case "$1" in - -h|--help|-\?) show_help; exit 0;; - -a|--artifact) ARTIFACT=$2; shift 2;; - -o|--output) OUTPUT=$2; shift 2;; - -*) shift;; - esac -done - -if [ "${ARTIFACT}" == "" ] || [ "${OUTPUT}" == "" ] -then - show_help; - exit 1 -fi - -echo -e "Download from S3 $ARTIFACT to $OUTPUT" -test ! -d $OUTPUT && mkdir -p $OUTPUT - -IS_PRESENT="$(aws s3 ls $ARTIFACT | wc -l | tr -d ' ')" -if [ "${IS_PRESENT}" == "1" ] -then - echo "File ${ARTIFACT} is present. Copying" - aws s3 cp $ARTIFACT ./s3-artifact.tmp - tar -xf ./s3-artifact.tmp -C $OUTPUT - rm ./s3-artifact.tmp -else - echo "File ${ARTIFACT} not present" - exit 1; -fi diff --git a/scripts/ci/utils/artifact-to-s3.sh b/scripts/ci/utils/artifact-to-s3.sh deleted file mode 100755 index 7cf74f98b1..0000000000 --- a/scripts/ci/utils/artifact-to-s3.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env bash - -show_help() { - echo "Usage: dbpci-artifact-to-s3 " - echo "" - echo "-a or --artifact [mandatory]: path to the artifact to archieve (tar.bz2) and upload (like ./dist)" - echo "-o or --output [mandatory]: the S3 object to copy it to, like: s3://bucket-name/folder/whatever.tar.bz2" -} - -while [[ $1 == -* ]]; do - case "$1" in - -h|--help|-\?) show_help; exit 0;; - -a|--artifact) ARTIFACT=$2; shift 2;; - -o|--output) OUTPUT=$2; shift 2;; - -*) shift;; - esac -done - -if [ "${ARTIFACT}" == "" ] || [ "${OUTPUT}" == "" ] -then - show_help; - exit 1 -fi - -tar cfj ./s3-artifact.tmp -C $ARTIFACT `ls -A $ARTIFACT` -aws s3 cp ./s3-artifact.tmp $OUTPUT -rm ./s3-artifact.tmp diff --git a/scripts/github/build/bumpversion.sh b/scripts/github/build/bumpversion.sh deleted file mode 100755 index 33c0ed4f46..0000000000 --- a/scripts/github/build/bumpversion.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -cd $DIR/../../../ -BRANCH=${GITHUB_REF##*/} -if [[ $BRANCH =~ ^develop(-patch.*)?$ ]] -then - echo "Replace NPM version with new Alpha tag" - NEXT_VERSION=-nextalpha - ./scripts/update-version.sh -gnu $NEXT_VERSION || exit 1; -fi - - diff --git a/scripts/github/storybook-testing/storybook-test.sh b/scripts/github/storybook-testing/storybook-test.sh deleted file mode 100755 index fef07d2d97..0000000000 --- a/scripts/github/storybook-testing/storybook-test.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env bash - -# Increase the max_user_watches -sudo sysctl -w fs.inotify.max_user_watches=524288 - -# Run Playwright Storybook Tests -npx playwright test --config='e2e-playwright/playwright.config.ts' || exit 1 diff --git a/scripts/github/update/adf-same-commit-verify.js b/scripts/github/update/adf-same-commit-verify.js deleted file mode 100644 index 6882ff5df4..0000000000 --- a/scripts/github/update/adf-same-commit-verify.js +++ /dev/null @@ -1,71 +0,0 @@ -#!/usr/bin/env node - -const GitHub = require('github-api'); -let program = require('commander'); - -const ORGANISATION = 'Alfresco'; -const ORIGIN_REPO = 'alfresco-ng2-components'; - -class PrCreator { - constructor(githubUser, githubRepo, token, commit) { - this.github = new GitHub({token}); - this.repoOrigin = this.github.getRepo(githubUser, ORIGIN_REPO); - this.repoDestination = this.github.getRepo(githubUser, githubRepo); - this.commit = commit; - } - - async getShaClosedPr(head, base) { - return this.getShaPr(head, base, 'closed'); - } - - async getShaOpenPr(head, base) { - return this.getShaPr(head, base, 'open'); - } - - async getShaPr(head, base, status) { - const { data: closedUpstreamPRs } = await this.repoDestination.listPullRequests({ state: status, head: `${ORGANISATION}:${head}`, base }); - if (closedUpstreamPRs.length > 0) { - const latestClosedUpstream = closedUpstreamPRs[0]; - return latestClosedUpstream.body.split(':')[1].trim(); - } - return ''; - } - -} - -async function main() { - - program - .version('0.1.0') - .option('--host [type]', 'Remote environment host adf.lab.com ') - .option('-t, --token [type]', 'token') - .option('-h, --head [type]', 'head') - .option('-r, --repo [type]', 'repo') - .option('-c, --commit [type]', 'commit') - .parse(process.argv); - - const { token, head, repo, commit } = program, - prCreator = new PrCreator(ORGANISATION, repo, token, commit); - - - const baseBranchName = 'develop'; - - const shaOpen = await prCreator.getShaOpenPr(head, baseBranchName); - const shaClosed = await prCreator.getShaClosedPr(head, baseBranchName); - if (shaOpen === commit || shaClosed === commit) { - console.log('ADF sha already exist'); - return 'true'; - } - return 'false'; -} - -main() - .then(result => { - process.stdout.write(result); - process.exit(0); - }) - .catch(error => { - console.error(error.response.status); - console.error(error.response.statusText); - process.exit(1); - }); diff --git a/scripts/npm-move-tag.sh b/scripts/npm-move-tag.sh deleted file mode 100755 index 0e476fd40f..0000000000 --- a/scripts/npm-move-tag.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -eval projects=( - "@alfresco/adf-cli" - "@alfresco/adf-core" - "@alfresco/adf-content-services" - "@alfresco/adf-insights" - "@alfresco/adf-process-services" - "@alfresco/adf-process-services-cloud" - "@alfresco/adf-testing" - "@alfresco/adf-extensions" ) - -show_help() { - echo "Usage: npm-move-tag.sh" - echo "" - echo "-v version package to apply new tag" - echo "-t new tag name to add" -} - -new_tag(){ - eval TAG=$1 -} - -package_version(){ - eval PACKAGE_VERSION=$1 -} - -while [[ $1 == -* ]]; do - case "$1" in - -h|--help|-\?) show_help; exit 0;; - -t|--tag) new_tag $2; shift 2;; - -v) package_version $2; shift 2;; - -*) echo "invalid option: $1" 1>&2; show_help; exit 0;; - esac -done - -for PACKAGE in ${projects[@]} -do - echo "====== Move ${PACKAGE}@${PACKAGE_VERSION} to tag ${TAG}===== " - echo "====== command npm dist-tag add ${PACKAGE}@${PACKAGE_VERSION} ${TAG}===== " - npm dist-tag add ${PACKAGE}@${PACKAGE_VERSION} ${TAG} -done diff --git a/scripts/pre-publish.js b/scripts/pre-publish.js deleted file mode 100644 index 7920438624..0000000000 --- a/scripts/pre-publish.js +++ /dev/null @@ -1,22 +0,0 @@ -var fs = require('fs'); -var file = require('../package.json'); - - -Object.keys(file.dependencies).forEach((currentDep)=>{ - - if(currentDep.indexOf("@alfresco/adf-")>=0) { - delete file.dependencies[currentDep]; - } -}); - -Object.keys(file.devDependencies).forEach((currentDep)=>{ - - if(currentDep.indexOf("@alfresco/adf-")>=0) { - delete file.devDependencies[currentDep]; - } -}); - - -fs.writeFileSync('package.json', JSON.stringify(file), function (err) { - if (err) return console.log(err); -}); diff --git a/scripts/release.sh b/scripts/release.sh deleted file mode 100755 index c0e7850183..0000000000 --- a/scripts/release.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/env bash -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -ROOTDIR="$DIR/.." -cd "$ROOTDIR"; - -VERSION=""; - -show_help() { - echo "Usage: release.sh -v [OPTIONS]" - echo "" - echo "-v or --version: the new version of the libraries" -} - -set_version() { - echo "====== Preparing to release version $1 =====" - VERSION=$1 -} - -escape_for_grep() { - chars_to_change="[^A-Za-z0-9_()']" - replace_with='\\&' - GREPPED=`echo "$1" | sed "s/$chars_to_change/$replace_with/g"` - echo $GREPPED; -} - -while [[ $1 == -* ]]; do - case "$1" in - -h|--help|-\?) show_help; exit 0;; - -v|--version) set_version $2; shift 2;; - -*) shift;; - esac -done - -LICENSE_ROW="- [ADF $VERSION](license-info-$VERSION.md)"; -LICENSE_GREP=`escape_for_grep "$LICENSE_ROW"` -LICENSE_README="$ROOTDIR/docs/license-info/README.md"; -LICENSE_GREP_RESULT=`grep "$LICENSE_GREP" "$LICENSE_README"`; - -#./scripts/update-version.sh -v $VERSION - -if [ -z "$LICENSE_GREP_RESULT" ]; -then - echo -e "\e[33mAdding third party license info for version: $VERSION\e[0m" - npx @alfresco/adf-cli licenses - mv "$ROOTDIR/license-info-$VERSION.md" "$ROOTDIR/docs/license-info/license-info-$VERSION.md" - echo $LICENSE_ROW >> $LICENSE_README -else - echo -e "\e[32mThird party license info is already added for version: $VERSION, nothing to do here.\e[0m" -fi - -VULNERABILITY_ROW="- [ADF $VERSION](audit-info-$VERSION.md)"; -VULNERABILITY_GREP=`escape_for_grep "$VULNERABILITY_ROW"` -VULNERABILITY_README="$ROOTDIR/docs/vulnerability/README.md"; -VULNERABILITY_GREP_RESULT=`grep "$VULNERABILITY_GREP" "$VULNERABILITY_README"`; - -if [ -z "$VULNERABILITY_GREP_RESULT" ]; -then - echo -e "\e[33mAdding vulnerability info for version: $VERSION\e[0m" - npx @alfresco/adf-cli@alpha audit - mv "$ROOTDIR/audit-info-$VERSION.md" "$ROOTDIR/docs/vulnerability/audit-info-$VERSION.md" - echo $VULNERABILITY_ROW >> $VULNERABILITY_README -else - echo -e "\e[32mVulnerability info is already added for version: $VERSION, nothing to do here.\e[0m" -fi diff --git a/scripts/update-version.sh b/scripts/update-version.sh deleted file mode 100755 index 997b252cbc..0000000000 --- a/scripts/update-version.sh +++ /dev/null @@ -1,242 +0,0 @@ -#!/usr/bin/env bash - -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -VERSION_IN_PACKAGE_JSON=`node -p "require('$DIR/../package.json')".version;`; - -eval JS_API=true -eval GNU=false -eval DIFFERENT_JS_API=false -eval AUTO=false -eval TOTAL_BUILD=true; -eval SEMANTIC="minor"; - -eval projects=( "cli" - "core" - "content-services" - "process-services" - "process-services-cloud" - "insights" - "testing" - "extensions" ) - -cd `dirname $0` - -prefix="@alfresco\/adf-" - -projectslength=${#projects[@]} - -show_help() { - echo "Usage: update-version.sh" - echo "" - echo "-vj or -versionjsapi to use a different version of js-api" - echo "-v or -version version to update" - echo "-major increase the major number and reset minor and patch" - echo "-minor increase the minor number and reset the patch number" - echo "-patch increase the patch number" - echo "-nextalpha update next alpha version of js-api and lib automatically" - echo "-nextbeta update next beta version of js-api and lib automatically" - echo "-alpha update last alpha version of js-api and lib automatically" - echo "-beta update beta alpha version of js-api and lib automatically" - echo "-gnu for gnu" -} - -last_alpha_mode() { - length=`expr $projectslength - 1` - echo "====== Auto find last ALPHA version of ${projects[${length}]} =====" - VERSION=$(npm view @alfresco/adf-${projects[${length}]}@alpha version) - - echo "====== version lib ${VERSION} =====" -} - -next_alpha_mode() { - # If we are creating a new alpha for a prerelease, we need to simply call it with -alpha - if [[ $VERSION_IN_PACKAGE_JSON =~ [0-9]*\.[0-9]*\.[0-9]*-.* ]]; then - SEMANTIC_PARAM=""; - else - SEMANTIC_PARAM="-${SEMANTIC}"; - fi - - echo "====== Auto find next ALPHA version ===== ${SEMANTIC_PARAM} " - VERSION=$(./next_version.sh ${SEMANTIC_PARAM} -alpha) - - echo "====== version lib ${VERSION} =====" - JS_API=false -} - -next_beta_mode() { - echo "====== Auto find next BETA version ===== ${SEMANTIC}" - VERSION=$(./next_version.sh -${SEMANTIC} -beta) - - echo "====== version lib ${VERSION} =====" - JS_API=false -} - -last_beta_mode() { - echo "====== Auto find last BETA version =====" - VERSION=$(npm view @alfresco/adf-core@beta version) - - echo "====== version lib ${VERSION} =====" - - DIFFERENT_JS_API=true - VERSION_JS_API=$(npm view @alfresco/js-api@alpha version) - - echo "====== version js-api ${DIFFERENT_JS_API} =====" -} - -gnu_mode() { - echo "====== GNU MODE =====" - GNU=true -} - -semantic_set() { - echo "====== semantic MODE $1 =====" - SEMANTIC=$1 -} - -version_change() { - echo "====== New version $1 =====" - VERSION=$1 -} - -version_js_change() { - echo "====== Alfresco JS-API version $1 =====" - VERSION_JS_API=$1 - DIFFERENT_JS_API=true -} - -update_component_version() { - echo "====== UPDATE PACKAGE VERSION of ${PACKAGE} to ${VERSION} version in all the package.json ======" - DESTDIR="$DIR/../lib/${1}" - cd $DESTDIR - npm version --allow-same-version --no-git-tag-version --force ${VERSION} - cd - -} - -update_component_dependency_version(){ - DESTDIR="$DIR/../lib/${1}" - - for (( j=0; j<${projectslength}; j++ )); - do - echo "====== UPDATE DEPENDENCY VERSION of .* to ~${VERSION} in ${1}======" - - sed "${sedi[@]}" "s/\"${prefix}${projects[$j]}\": \".*\"/\"${prefix}${projects[$j]}\": \"${VERSION}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${prefix}${projects[$j]}\": \"~.*\"/\"${prefix}${projects[$j]}\": \"~${VERSION}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${prefix}${projects[$j]}\": \"^.*\"/\"${prefix}${projects[$j]}\": \"^${VERSION}\"/g" ${DESTDIR}/package.json - - done -} - -update_total_build_dependency_version(){ - DESTDIR="$DIR/../" - - for (( j=0; j<${projectslength}; j++ )); - do - echo "====== UPDATE TOTAL BUILD DEPENDENCY VERSION of .* to ~${VERSION} in ${1}======" - sed "${sedi[@]}" "s/\"${prefix}${projects[$j]}\": \".*\"/\"${prefix}${projects[$j]}\": \"${VERSION}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${prefix}${projects[$j]}\": \"~.*\"/\"${prefix}${projects[$j]}\": \"~${VERSION}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${prefix}${projects[$j]}\": \"^.*\"/\"${prefix}${projects[$j]}\": \"^${VERSION}\"/g" ${DESTDIR}/package.json - done -} - -update_total_build_dependency_js_version(){ - echo "====== UPDATE DEPENDENCY VERSION @alfresco/js-api total build to ~${1} in ${DESTDIR}======" - DESTDIR="$DIR/../" - PACKAGETOCHANGE="@alfresco\/js-api" - - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \".*\"/\"${PACKAGETOCHANGE}\": \"${1}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \"~.*\"/\"${PACKAGETOCHANGE}\": \"${1}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \"^.*\"/\"${PACKAGETOCHANGE}\": \"${1}\"/g" ${DESTDIR}/package.json -} - -update_component_js_version(){ - echo "====== UPDATE DEPENDENCY VERSION of @alfresco/js-api in ${1} to ${2} ======" - DESTDIR="$DIR/../lib/${1}" - - PACKAGETOCHANGE="@alfresco\/js-api" - - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \".*\"/\"${PACKAGETOCHANGE}\": \"${2}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \"~.*\"/\"${PACKAGETOCHANGE}\": \"${2}\"/g" ${DESTDIR}/package.json - sed "${sedi[@]}" "s/\"${PACKAGETOCHANGE}\": \"^.*\"/\"${PACKAGETOCHANGE}\": \"${2}\"/g" ${DESTDIR}/package.json - -} - -args=("$@") - -while [[ $1 == -* ]]; do - case "$1" in - -major) semantic_set "major"; shift;; - -minor) semantic_set "minor"; shift;; - -patch) semantic_set "patch"; shift;; - -*) shift;; - esac -done - -set -- "${args[@]}" - -while [[ $1 == -* ]]; do - case "$1" in - -h|--help|-\?) show_help; exit 0;; - -v|version) version_change $2; shift 2;; - -sj|sjsapi) skip_js; shift;; - -vj|versionjsapi) version_js_change $2; shift 2;; - -gnu) gnu_mode; shift;; - -alpha) last_alpha_mode; shift;; - -nextalpha) next_alpha_mode; shift;; - -beta) last_beta_mode; shift;; - -nextbeta) next_beta_mode; shift;; - -*) shift;; - esac -done - -if $GNU; then - sedi='-i' -else - sedi=('-i' '') -fi - -if [[ "${VERSION}" == "" ]] -then - echo "Version number required" - exit 1 -fi - -cd "$DIR/../" - -echo "====== UPDATE COMPONENTS ======" - -# use for loop to read all values and indexes -for (( i=0; i<${projectslength}; i++ )); -do - echo "====== UPDATE COMPONENT ${projects[$i]} ======" - update_component_version ${projects[$i]} - update_component_dependency_version ${projects[$i]} - - if $JS_API == true; then - - if $DIFFERENT_JS_API == true; then - update_component_js_version ${projects[$i]} ${VERSION_JS_API} - else - update_component_js_version ${projects[$i]} ${VERSION} - fi - - fi -done - -update_total_build_dependency_version - -if $JS_API == true; then - if $DIFFERENT_JS_API == true; then - update_total_build_dependency_js_version ${VERSION_JS_API} - else - update_total_build_dependency_js_version ${VERSION} - fi -fi - -echo "====== UPDATE DEMO SHELL ======" - -DESTDIR="$DIR/../demo-shell/" -npm version --allow-same-version --no-git-tag-version --force ${VERSION} - -cd $DESTDIR -npm version --allow-same-version --no-git-tag-version --force ${VERSION} -cd -