diff --git a/.travis.yml b/.travis.yml index fcb9424aee..b9451a95b8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -24,11 +24,18 @@ branches: stages: - name: Lint & Build Dist - name: Unit test + - name: Release on npm + if: type = push + - name: Check bundle + if: type = push + - name: Deploy docker + if: type = push + - name: Update Rancher + if: type = push - name: e2e Test - name: Deploy PR if: type = pull_request - - name: Release on npm - if: branch = development AND type = push + addons: chrome: stable @@ -91,6 +98,24 @@ jobs: - stage: Release on npm script: - ./lib/dist/cli/bin/adf-cli npm-publish --npmRegistry $NPM_REGISTRY_ADDRESS --tokenRegistry $NPM_REGISTRY_TOKEN --tag $TAG_NPM --pathProject "$(pwd)" + - stage: Check bundle + script: + - ADF_VERSION=$(npm view @alfresco/adf-core@${TAG_NPM} version) + - ./scripts/npm-check-bundles.sh -v ${ADF_VERSION} + - stage: Deploy docker + script: + - TAG_VERSION=$(./scripts/travis/deploy/tag-travis-branch.sh) + - echo "Running the docker with tag" $TAG_VERSION + - ./lib/dist/cli/bin/adf-cli docker-publish --loginCheck --loginUsername "$DOCKER_REPOSITORY_USER" --loginPassword "$DOCKER_REPOSITORY_PASSWORD" --loginRepo "$DOCKER_REPOSITORY_DOMAIN" --dockerRepo "$DOCKER_REPOSITORY" --dockerTags "$TAG_VERSION" --pathProject "$(pwd)" + - stage: Update Rancher + script: + - TAG_VERSION=$(./scripts/travis/deploy/tag-travis-branch.sh) + - ./scripts/rancher-update.sh \ + --access_key $RANCHER_TOKEN \ + --secret_key $RANCHER_SECRET \ + --url $REPO_RANCHER \ + --environment_name $REPO_RANCHER_ADF_NAME \ + --image docker:alfresco/demo-shell:$TAG_VERSION before_deploy: diff --git a/scripts/travis/deploy/tag-travis-branch.sh b/scripts/travis/deploy/tag-travis-branch.sh new file mode 100755 index 0000000000..605693a930 --- /dev/null +++ b/scripts/travis/deploy/tag-travis-branch.sh @@ -0,0 +1,9 @@ +#!/usr/bin/env bash + +if [[ $TRAVIS_BRANCH == "master" ]]; then + TAG_VERSION=$(grep -m1 version package.json | awk '{ print $2 }' | sed 's/[", ]//g') +else + TAG_VERSION=$TRAVIS_BRANCH-$TRAVIS_BUILD_NUMBER +fi; + +echo $TAG_VERSION;