[ADF-2462] Automatic project update after any beta (#3075)

* First try

* Fix typo

* Fix filename

* use https

* create pull request with github token

* gnu  version

* clone with token

* try example beta 13

* if beta tag only exectute

* update other projects

* unify script

* documentation
This commit is contained in:
Eugenio Romano
2018-03-14 11:19:06 +00:00
committed by GitHub
parent 18ec14f210
commit 4faa93cff0
3 changed files with 100 additions and 0 deletions

View File

@@ -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:

View File

@@ -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
```

61
scripts/update-project.sh Executable file
View File

@@ -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;