Skip to content

Commit

Permalink
Fix some build scripts (#7048)
Browse files Browse the repository at this point in the history
Make publish run on API
  • Loading branch information
eromano authored May 20, 2021
1 parent a5e85b4 commit ac6f616
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 15 deletions.
16 changes: 9 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import:
- source: Alfresco/alfresco-build-tools:.travis.docker_hub_login.yml@v1.1.1

git:
depth: 3
quiet: true
Expand Down Expand Up @@ -54,13 +54,13 @@ stages:
- name: "Check bundle"
if: type = push AND tag IS blank
- name: "Trigger Alpha ADF child build"
if: branch = develop AND type = cron
if: branch = develop AND (type = cron || type = api)
- name: "Build Demo shell"
if: tag IS blank
- name: "Unit test Lib"
if: type = cron || type = pull_request
if: type = pull_request || (type = cron || type = api)
- name: "e2e Test"
if: type = cron || type = pull_request
if: type = pull_request || (type = cron || type = api)
- name: "Release tag"
if: branch = master
- name: "Deprecate develop builds"
Expand Down Expand Up @@ -99,8 +99,8 @@ jobs:
- stage: "Build lib"
name: "Lib::Build"
script:
- ./scripts/travis/build/build-libs.sh
- ./scripts/travis/release/release-npm.sh
- ./scripts/travis/build/build-libs.sh || travis_terminate 1
- ./scripts/travis/release/release-npm.sh || travis_terminate 1
workspaces:
create:
name: built_libs_cache
Expand Down Expand Up @@ -163,7 +163,9 @@ jobs:
script: ./scripts/travis/release/git-tag.sh

- stage: "Deprecate develop builds"
script: ./scripts/travis/release/deprecate-develop-build.sh -v ${ADF_VERSION}
script:
- ADF_VERSION=$(npm view @alfresco/adf-core@${TAG_NPM} version)
- ./scripts/travis/release/deprecate-develop-build.sh -v ${ADF_VERSION}

- stage: "e2e Test"
name: "Core"
Expand Down
44 changes: 44 additions & 0 deletions scripts/npm-move-tag.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/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
6 changes: 4 additions & 2 deletions scripts/travis/build/build-libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ rm -rf tmp && mkdir tmp;

npx @alfresco/adf-cli@alpha update-commit-sha --pointer "HEAD" --pathPackage "$(pwd)"

if [ $TRAVIS_EVENT_TYPE == "push" ] || [ $TRAVIS_EVENT_TYPE == "cron" ]
if [ $TRAVIS_EVENT_TYPE == "push" ] || [ $TRAVIS_EVENT_TYPE == "cron" ] || [ $TRAVIS_EVENT_TYPE == "api" ]
then
if [ $TRAVIS_BRANCH == "develop"] || [ $TRAVIS_EVENT_TYPE == "cron" ]
if [ $TRAVIS_BRANCH == "develop" ] || [ $TRAVIS_EVENT_TYPE == "cron" ] || [ $TRAVIS_EVENT_TYPE == "api" ]
then

echo "Replace NPM version with new Alpha tag"
NEXT_VERSION=-nextalpha
./scripts/update-version.sh -gnu $NEXT_VERSION || exit 1;
fi
Expand Down
8 changes: 2 additions & 6 deletions scripts/travis/release/release-npm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,11 @@ DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

cd $DIR/../../../

if [ $TRAVIS_EVENT_TYPE == "push" ] || [ $TRAVIS_EVENT_TYPE == "cron" ]
if [ $TRAVIS_EVENT_TYPE == "push" ] || [ $TRAVIS_EVENT_TYPE == "cron" ] || [ $TRAVIS_EVENT_TYPE == "api" ]
then
TAG_NPM=latest
if [[ $TRAVIS_BRANCH == "develop" ]];
then
TAG_NPM=alpha
fi

if [[ $TRAVIS_EVENT_TYPE == "cron" ]];
if [ $TRAVIS_BRANCH == "develop" ] || [ $TRAVIS_EVENT_TYPE == "cron" ] || [ $TRAVIS_EVENT_TYPE == "api" ]
then
TAG_NPM=alpha
fi
Expand Down

0 comments on commit ac6f616

Please sign in to comment.