root / TXM / trunk / org.txm.setups / pushTXMExtUpdateToGIT.sh @ 3453
Historique | Voir | Annoter | Télécharger (1,49 ko)
1 | 3070 | mdecorde | #!/bin/bash |
---|---|---|---|
2 | 3070 | mdecorde | |
3 | 3070 | mdecorde | if [ ! $# -eq 2 ] |
4 | 3070 | mdecorde | then |
5 | 3070 | mdecorde | echo "** Error: called with $# args. usage: 'pushTXMExtUpdateToGIT.sh VERSION LEVEL'" |
6 | 3298 | mdecorde | echo "** eg ./pushTXMExtUpdateToGIT.sh 0.8.2 alpha" |
7 | 3070 | mdecorde | exit 1 |
8 | 3070 | mdecorde | fi |
9 | 3070 | mdecorde | |
10 | 3070 | mdecorde | CURRENTPATH="$(dirname $(realpath $0))" |
11 | 3070 | mdecorde | echo "PATH='$PATH'" |
12 | 3070 | mdecorde | VERSION=$1 |
13 | 3070 | mdecorde | |
14 | 3070 | mdecorde | LEVEL=$2 |
15 | 3070 | mdecorde | LEVEL="${LEVEL,,}" |
16 | 3070 | mdecorde | TXMGITROOT=~/GIT/txm-software |
17 | 3070 | mdecorde | TXMGITLOCAL="dist/$VERSION/ext/$LEVEL" |
18 | 3070 | mdecorde | TXMGIT=$TXMGITROOT/$TXMGITLOCAL |
19 | 3070 | mdecorde | |
20 | 3086 | mdecorde | mkdir -p $TXMGIT |
21 | 3086 | mdecorde | |
22 | 3086 | mdecorde | echo "TXM GIT directory: $TXMGIT" |
23 | 3086 | mdecorde | |
24 | 3070 | mdecorde | if [ ! -d "$TXMGIT" ]; then |
25 | 3070 | mdecorde | echo "** Error the GIT directory does not exists: $TXMGIT" |
26 | 3070 | mdecorde | exit 1; |
27 | 3070 | mdecorde | fi |
28 | 3070 | mdecorde | |
29 | 3086 | mdecorde | DIRECTORYTOCOPY="TXMReleasePlugins.site" |
30 | 3086 | mdecorde | if [ "$LEVEL" = "dev" ]; then |
31 | 3086 | mdecorde | DIRECTORYTOCOPY="TXMDevPlugins.site" |
32 | 3086 | mdecorde | fi |
33 | 3086 | mdecorde | if [ "$LEVEL" = "alpha" ]; then |
34 | 3086 | mdecorde | DIRECTORYTOCOPY="TXMAlphaPlugins.site" |
35 | 3086 | mdecorde | fi |
36 | 3086 | mdecorde | if [ "$LEVEL" = "beta" ]; then |
37 | 3086 | mdecorde | DIRECTORYTOCOPY="TXMBetaPlugins.site" |
38 | 3086 | mdecorde | fi |
39 | 3086 | mdecorde | |
40 | 3086 | mdecorde | DIRECTORYTOCOPY="$CURRENTPATH/../$DIRECTORYTOCOPY" |
41 | 3086 | mdecorde | if [ ! -d "$DIRECTORYTOCOPY" ]; then |
42 | 3070 | mdecorde | echo "** Error: no TXM repository build found: $CURRENTPATH/exportRCP/repository" |
43 | 3070 | mdecorde | exit 1; |
44 | 3070 | mdecorde | fi |
45 | 3070 | mdecorde | |
46 | 3086 | mdecorde | echo "Directory to copy: $DIRECTORYTOCOPY" |
47 | 3070 | mdecorde | |
48 | 3070 | mdecorde | echo "Preparing GIT push..." |
49 | 3070 | mdecorde | pushd $TXMGIT |
50 | 3070 | mdecorde | |
51 | 3070 | mdecorde | if [ -z "$(git status --porcelain $TXMGIT)" ]; then |
52 | 3070 | mdecorde | echo "GIT OK" |
53 | 3070 | mdecorde | else |
54 | 3070 | mdecorde | echo "Aborting GIT push: $TXMGIT repository is not clean." |
55 | 3070 | mdecorde | popd |
56 | 3070 | mdecorde | exit 1 |
57 | 3070 | mdecorde | fi |
58 | 3070 | mdecorde | |
59 | 3070 | mdecorde | echo "rm previous version in `pwd`..." |
60 | 3070 | mdecorde | git rm -r binary/* |
61 | 3070 | mdecorde | git rm -r features/* |
62 | 3070 | mdecorde | git rm -r plugins/* |
63 | 3070 | mdecorde | |
64 | 3070 | mdecorde | pwd |
65 | 3070 | mdecorde | echo "cp new build..." |
66 | 3086 | mdecorde | cp -rf $DIRECTORYTOCOPY/* . |
67 | 3070 | mdecorde | |
68 | 3070 | mdecorde | echo "git add commit push..." |
69 | 3070 | mdecorde | git add --all . |
70 | 3070 | mdecorde | git commit -m "push $LEVEL update of TXM-$VERSION" |
71 | 3070 | mdecorde | git push |
72 | 3070 | mdecorde | |
73 | 3070 | mdecorde | popd |
74 | 3070 | mdecorde | |
75 | 3070 | mdecorde | echo "Done." |