mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-05-12 17:04:57 +00:00
[AAE-11259] Pipeline - Decoupling the build from release (#7935)
* Decoupling the build from release * test if we are still able to release on npm and docker * Split docker tag from deploy * Fix storybook * Decouple build lib/apps from releasing * Remove useless or
This commit is contained in:
parent
b48784a04e
commit
1c46bb83a0
29
.travis.yml
29
.travis.yml
@ -22,6 +22,7 @@ env:
|
||||
|
||||
- S3_DBP_PATH="s3://alfresco-travis-builds/adf"
|
||||
- DEMO_SHELL_DIR="./dist/demo-shell"
|
||||
- STORYBOOK_DIR="./dist/storybook/stories"
|
||||
- BUILT_LIBS_DIR="./dist/libs"
|
||||
- NODE_MODULES_DIR="./node_modules"
|
||||
- SMART_RUNNER_DIRECTORY=".protractor-smartrunner"
|
||||
@ -49,8 +50,6 @@ branches:
|
||||
- /^develop(-patch.*)?$/
|
||||
- master
|
||||
- develop
|
||||
#remove after upgrade
|
||||
- angular-14-rebase
|
||||
- /.*old-env.*/
|
||||
- /.*next-release.*/
|
||||
- /.*beta.*/
|
||||
@ -66,6 +65,8 @@ stages:
|
||||
if: (branch = develop AND (type = cron || type = api)) OR commit_message =~ /\[trigger adf\]/
|
||||
- name: "Build Demo shell"
|
||||
if: tag IS blank
|
||||
- name: "Release"
|
||||
if: type = push OR type = cron || type = api
|
||||
- name: "Unit test Lib"
|
||||
if: type = pull_request || (type = cron || type = api)
|
||||
- name: "e2e Test"
|
||||
@ -104,12 +105,10 @@ jobs:
|
||||
- "$NODE_MODULES_DIR"
|
||||
use: node_modules_cache
|
||||
|
||||
# Run Only for any PR
|
||||
- stage: "Build lib"
|
||||
name: "Lib::Build"
|
||||
script:
|
||||
- ./scripts/travis/build/build-libs.sh || travis_terminate 1
|
||||
- ./scripts/travis/release/release-npm.sh || travis_terminate 1
|
||||
- nx affected:build $NX_CALCULATION_FLAGS --prod --exclude="demoshell"
|
||||
workspaces:
|
||||
create:
|
||||
name: built_libs_cache
|
||||
@ -125,19 +124,19 @@ jobs:
|
||||
use: node_modules_cache
|
||||
|
||||
- stage: "Build Demo shell"
|
||||
name: "Demo Shell & Storybook :Build && dockerize"
|
||||
name: "Demo Shell & Storybook :Build"
|
||||
before_script:
|
||||
- NODE_OPTIONS="--max-old-space-size=8192" $(npm bin)/nx run cli:build --prod
|
||||
script:
|
||||
# Build Demo shell & Storybook for production docker"
|
||||
- NODE_OPTIONS=--max_old_space_size=8192 nx build demoshell --configuration production
|
||||
- NODE_OPTIONS=--max_old_space_size=8192 nx run stories:build-storybook --configuration ci
|
||||
- ./scripts/travis/release/release-docker.sh
|
||||
workspaces:
|
||||
create:
|
||||
name: built_demo_shell_cache
|
||||
paths:
|
||||
- "$DEMO_SHELL_DIR"
|
||||
- "$STORYBOOK_DIR"
|
||||
use:
|
||||
- built_libs_cache
|
||||
|
||||
@ -171,6 +170,22 @@ jobs:
|
||||
workspaces:
|
||||
use: built_libs_cache
|
||||
|
||||
- stage: "Release"
|
||||
name: "release::npm"
|
||||
script:
|
||||
- ./scripts/travis/release/prepublish.sh || travis_terminate 1
|
||||
- ./scripts/travis/release/release-npm.sh || travis_terminate 1
|
||||
workspaces:
|
||||
use: built_libs_cache
|
||||
|
||||
- stage: "Release"
|
||||
name: "release::docker"
|
||||
script:
|
||||
- ./scripts/travis/release/docker-tag.sh
|
||||
- ./scripts/travis/release/release-docker.sh
|
||||
workspaces:
|
||||
use: built_demo_shell_cache
|
||||
|
||||
- stage: "Release tag"
|
||||
script: ./scripts/travis/release/git-tag.sh
|
||||
|
||||
|
@ -19,7 +19,6 @@
|
||||
"01": "echo -------------------------------------------- Build Lib -----------------------------------------------",
|
||||
"01s": "",
|
||||
"unit-test": "concurrently \"nx test content-services --watch=false\" \"nx test process-services --watch=false\" \"nx test core --watch=false\" \"nx test extensions --watch=false\" \"nx test insights --watch=false\" \"nx test process-services-cloud --watch=false\" ",
|
||||
"build-lib": "./scripts/build/build-all-lib.sh",
|
||||
"affected:libs": "nx affected:libs",
|
||||
"inspect.bundle": "nx build demoshell --configuration production --stats-json && npx webpack-bundle-analyzer dist/demo-shell/stats.json",
|
||||
"coverage": "./lib/config/create-coverage-index.sh && lite-server -c ./lib/config/proxy-coverage.json",
|
||||
|
16
scripts/travis/release/docker-tag.sh
Executable file
16
scripts/travis/release/docker-tag.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR/../../../
|
||||
|
||||
if [[ $TRAVIS_BRANCH =~ ^master(-patch.*)?$ ]]; then
|
||||
export TAGS=$(grep -m1 version package.json | awk '{ print $2 }' | sed 's/[", ]//g')
|
||||
else
|
||||
if [[ "${TRAVIS_PULL_REQUEST_BRANCH}" != "" ]];
|
||||
then
|
||||
export TAGS=""$TRAVIS_PULL_REQUEST_BRANCH-$TRAVIS_BUILD_NUMBER""
|
||||
else
|
||||
export TAGS="$TRAVIS_BRANCH-$TRAVIS_BUILD_NUMBER,$TRAVIS_BRANCH"
|
||||
fi;
|
||||
|
||||
fi;
|
23
scripts/travis/release/prepublish.sh
Executable file
23
scripts/travis/release/prepublish.sh
Executable file
@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/../../../
|
||||
|
||||
if [[ $TRAVIS_BRANCH =~ ^develop(-patch.*)?$ ]]
|
||||
then
|
||||
isSameADFSha=$(node ./scripts/travis/update/adf-same-commit-verify.js --token=$TOKEN --head=$BRANCH_TO_CREATE --repo=$NAME_REPO --commit=$COMMIT )
|
||||
if [ "$isSameADFSha" = 'true' ]; then
|
||||
echo 'ADF sha is the same. No need to publish again on NPM'
|
||||
else
|
||||
echo "Replace NPM version with new Alpha tag"
|
||||
NEXT_VERSION=-nextalpha
|
||||
./scripts/update-version.sh -gnu $NEXT_VERSION || exit 1;
|
||||
fi
|
||||
fi
|
||||
|
||||
node ./scripts/pre-publish.js
|
||||
|
||||
echo "====== Prebuilt Themes ====="
|
||||
nx affected $NX_CALCULATION_FLAGS --target=pretheme
|
||||
|
@ -1,54 +1,22 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
cd $DIR/../../../
|
||||
|
||||
echo "ℹ️ demo-shell: Running the docker with tag" $TAGS
|
||||
|
||||
DOCKER_PROJECT_ARGS="PROJECT_NAME=demo-shell"
|
||||
|
||||
# Publish Image to docker
|
||||
./node_modules/@alfresco/adf-cli/bin/adf-cli docker --loginCheck --loginUsername "$DOCKER_REPOSITORY_USER" --loginPassword "$DOCKER_REPOSITORY_PASSWORD" --loginRepo "$DOCKER_REPOSITORY_DOMAIN" --dockerRepo "$DOCKER_REPOSITORY" --buildArgs "$DOCKER_PROJECT_ARGS" --dockerTags "$TAGS" --pathProject "$(pwd)"
|
||||
|
||||
echo "ℹ️ storybook-shell: Running the docker with tag" $TAGS
|
||||
|
||||
DOCKER_PROJECT_ARGS="PROJECT_NAME=storybook/stories"
|
||||
|
||||
echo "{}" > $DIR/../../../dist/storybook/stories/app.config.json
|
||||
|
||||
# Publish Image to docker
|
||||
./node_modules/@alfresco/adf-cli/bin/adf-cli docker --loginCheck --loginUsername "$DOCKER_REPOSITORY_USER" --loginPassword "$DOCKER_REPOSITORY_PASSWORD" --loginRepo "$DOCKER_REPOSITORY_DOMAIN" --dockerRepo "$DOCKER_REPOSITORY_STORYBOOK" --buildArgs "$DOCKER_PROJECT_ARGS" --dockerTags "$TAGS" --pathProject "$(pwd)"
|
||||
|
||||
|
||||
if [[ $TRAVIS_EVENT_TYPE == "pull_request" ]];
|
||||
then
|
||||
HEAD_COMMIT_HASH=${TRAVIS_PULL_REQUEST_SHA:-${TRAVIS_COMMIT}}
|
||||
COMMIT_MESSAGE=`git log --format=%B -n 1 $HEAD_COMMIT_HASH`
|
||||
fi;
|
||||
|
||||
echo "ℹ️ Check Docker Image release for $COMMIT_MESSAGE type $TRAVIS_EVENT_TYPE on branch $TRAVIS_PULL_REQUEST_BRANCH"
|
||||
|
||||
if [[ $TRAVIS_EVENT_TYPE == "push" || $TRAVIS_EVENT_TYPE == "cron" || ( $TRAVIS_EVENT_TYPE == "pull_request" && $COMMIT_MESSAGE == *"[create docker image]"* )]];
|
||||
then
|
||||
|
||||
if [[ $TRAVIS_BRANCH =~ ^develop(-patch.*)?$ || $TRAVIS_BRANCH =~ ^master(-patch.*)?$ ]];
|
||||
then
|
||||
|
||||
cd $DIR/../../../
|
||||
|
||||
if [[ $TRAVIS_BRANCH =~ ^master(-patch.*)?$ ]]; then
|
||||
TAGS=$(grep -m1 version package.json | awk '{ print $2 }' | sed 's/[", ]//g')
|
||||
else
|
||||
if [[ "${TRAVIS_PULL_REQUEST_BRANCH}" != "" ]];
|
||||
then
|
||||
TAGS=""$TRAVIS_PULL_REQUEST_BRANCH-$TRAVIS_BUILD_NUMBER""
|
||||
else
|
||||
TAGS="$TRAVIS_BRANCH-$TRAVIS_BUILD_NUMBER,$TRAVIS_BRANCH"
|
||||
fi;
|
||||
|
||||
fi;
|
||||
|
||||
echo "ℹ️ demo-shell: Running the docker with tag" $TAGS
|
||||
|
||||
DOCKER_PROJECT_ARGS="PROJECT_NAME=demo-shell"
|
||||
|
||||
# Publish Image to docker
|
||||
./node_modules/@alfresco/adf-cli/bin/adf-cli docker --loginCheck --loginUsername "$DOCKER_REPOSITORY_USER" --loginPassword "$DOCKER_REPOSITORY_PASSWORD" --loginRepo "$DOCKER_REPOSITORY_DOMAIN" --dockerRepo "$DOCKER_REPOSITORY" --buildArgs "$DOCKER_PROJECT_ARGS" --dockerTags "$TAGS" --pathProject "$(pwd)"
|
||||
|
||||
echo "ℹ️ storybook-shell: Running the docker with tag" $TAGS
|
||||
|
||||
DOCKER_PROJECT_ARGS="PROJECT_NAME=storybook/stories"
|
||||
|
||||
echo "{}" > $DIR/../../../dist/storybook/stories/app.config.json
|
||||
|
||||
# Publish Image to docker
|
||||
./node_modules/@alfresco/adf-cli/bin/adf-cli docker --loginCheck --loginUsername "$DOCKER_REPOSITORY_USER" --loginPassword "$DOCKER_REPOSITORY_PASSWORD" --loginRepo "$DOCKER_REPOSITORY_DOMAIN" --dockerRepo "$DOCKER_REPOSITORY_STORYBOOK" --buildArgs "$DOCKER_PROJECT_ARGS" --dockerTags "$TAGS" --pathProject "$(pwd)"
|
||||
|
||||
fi;
|
||||
else
|
||||
echo "✅ No need to release a docker image"
|
||||
fi;
|
||||
|
||||
|
@ -4,26 +4,15 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
cd $DIR/../../../
|
||||
|
||||
if [[ $TRAVIS_EVENT_TYPE == "push" ]] || [[ $TRAVIS_EVENT_TYPE == "cron" ]] || [[ $TRAVIS_EVENT_TYPE == "api" ]]
|
||||
if [[ $TRAVIS_BRANCH =~ ^master(-patch.*)?$ ]]
|
||||
then
|
||||
TAG_NPM=latest
|
||||
fi
|
||||
|
||||
if [[ $TRAVIS_BRANCH =~ ^master(-patch.*)?$ ]]
|
||||
then
|
||||
TAG_NPM=latest
|
||||
fi
|
||||
if [[ $TRAVIS_BRANCH =~ ^develop(-patch.*)?$ ]]
|
||||
then
|
||||
TAG_NPM=alpha
|
||||
fi
|
||||
|
||||
if [[ $TRAVIS_BRANCH =~ ^develop(-patch.*)?$ ]]
|
||||
then
|
||||
TAG_NPM=alpha
|
||||
fi
|
||||
|
||||
if [[ $TRAVIS_BRANCH =~ angular-14-rebase ]]
|
||||
then
|
||||
TAG_NPM=a14
|
||||
fi
|
||||
|
||||
echo "Publishing on npm with tag $TAG_NPM"
|
||||
./node_modules/@alfresco/adf-cli/bin/adf-cli npm-publish --npmRegistry $NPM_REGISTRY_ADDRESS --tokenRegistry $NPM_REGISTRY_TOKEN --tag $TAG_NPM --pathProject "$(pwd)"
|
||||
else
|
||||
echo "PR No need to release in NPM"
|
||||
fi;
|
||||
echo "Publishing on npm with tag $TAG_NPM"
|
||||
./node_modules/@alfresco/adf-cli/bin/adf-cli npm-publish --npmRegistry $NPM_REGISTRY_ADDRESS --tokenRegistry $NPM_REGISTRY_TOKEN --tag $TAG_NPM --pathProject "$(pwd)"
|
||||
|
Loading…
x
Reference in New Issue
Block a user