diff --git a/.travis.yml b/.travis.yml index 001e89ea77..01da07fcfb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,6 +64,15 @@ jobs: script: ./scripts/test-e2e-bc.sh - stage: Check ADF exports script: cd lib && npm run test-export + - stage: Update Generator + if: tag = ^beta.*$ + script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -name generator-ng2-alfresco-app + - stage: Update Content app + if: tag = ^beta.*$ + script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -name alfresco-content-app + - stage: Update DW + if: tag = ^beta.*$ + script: ./scripts/update-project.sh -gnu -t $GITHUB_TOKEN -name adf-app-manager-ui # jobs: # include: diff --git a/scripts/README.md b/scripts/README.md index ea0b607d45..c594cdbf4b 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -337,6 +337,36 @@ This script test that the update from 2.0.0 to 2.x.x is still smooth ## Examples +```sh +./test-e2e-bc +``` + +***update-project.sh*** + +Update an external project and create a PR with last beta of ADF + +## Options + +| Option | Description | +| --- | --- | +| -n or --name | name of the project | +| -gnu | for linux machine | +| -t or --token | GITHUB token | + +## Examples + +```sh +./update-project.sh -t YOUR_GITHUB_TOKEN -n NAME_PROJECT +``` + +# test-e2e-bc.sh + +***test-e2e-bc.sh*** + +This script test that the update from 2.0.0 to 2.x.x is still smooth + +## Examples + ```sh ./test-e2e-bc ``` \ No newline at end of file diff --git a/scripts/update-project.sh b/scripts/update-project.sh new file mode 100755 index 0000000000..cc76373744 --- /dev/null +++ b/scripts/update-project.sh @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +eval GNU=false + +set -e +TEMP_GENERATOR_DIR=".tmp-generator"; +VERSION=$(npm view @alfresco/adf-core@beta version)example13 + +show_help() { + echo "Usage: update-generator.sh" + echo "" + echo "-t or --token Github ouath token" + echo "-n or --name Github name of the project" + echo "-gnu for gnu" +} + +gnu_mode() { + echo "====== GNU MODE =====" + GNU=true +} + +token() { + TOKEN=$1 +} + +name_repo() { + NAME_REPO=$1 +} + +while [[ $1 == -* ]]; do + case "$1" in + -h|--help|-\?) show_help; exit 0;; + -n|--name|-\?) name_repo $2; shift 2;; + -gnu) gnu_mode; shift;; + -t|--token) token $2; shift 2;; + -*) echo "invalid option: $1" 1>&2; show_help; exit 1;; + esac +done + +rm -rf $TEMP_GENERATOR_DIR; + +git clone https://$TOKEN@github.com/Alfresco/$NAME_REPO.git $TEMP_GENERATOR_DIR +cd $TEMP_GENERATOR_DIR +git checkout development + +BRANCH="generator-update-beta-$VERSION" +git checkout -b $BRANCH + +if $GNU; then + ./scripts/update-version.sh -gnu -v $VERSION +else + ./scripts/update-version.sh -v $VERSION +fi + +git add . +git commit -m "Update generator to use packages version $VERSION" +git push -u origin $BRANCH + +curl -H "Authorization: token $TOKEN" -X POST -d '{"body":"Update generator to use packages version '$VERSION'","head":"'$BRANCH'","base":"development","title":"Update generator to use packages version"}' https://api.github.com/repos/alfresco/$NAME_REPO/pulls + +rm -rf $TEMP_GENERATOR_DIR;