mirror of
https://github.com/Alfresco/alfresco-ng2-components.git
synced 2025-07-24 17:32:15 +00:00
[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:
@@ -64,6 +64,15 @@ jobs:
|
|||||||
script: ./scripts/test-e2e-bc.sh
|
script: ./scripts/test-e2e-bc.sh
|
||||||
- stage: Check ADF exports
|
- stage: Check ADF exports
|
||||||
script: cd lib && npm run test-export
|
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:
|
# jobs:
|
||||||
# include:
|
# include:
|
||||||
|
@@ -337,6 +337,36 @@ This script test that the update from 2.0.0 to 2.x.x is still smooth
|
|||||||
|
|
||||||
## Examples
|
## 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
|
```sh
|
||||||
./test-e2e-bc
|
./test-e2e-bc
|
||||||
```
|
```
|
61
scripts/update-project.sh
Executable file
61
scripts/update-project.sh
Executable 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;
|
Reference in New Issue
Block a user