|
1 | | -#node -pe "require('./package.json').version" |
2 | | -#before_script: |
3 | | - # in master branch increment the version |
4 | | - #- npm version patch |
5 | | - # on: |
6 | | - # branch : master |
7 | | - #- npm install -g documentation |
8 | | - #- npm run doc |
9 | | - |
| 1 | +before_script: |
| 2 | + - | |
| 3 | + if [[ $TRAVIS_BRANCH == 'clientBuild' && $TRAVIS_COMMIT_MESSAGE == *"[run deploy]"* ]]; then |
| 4 | + echo "__INCREMENT_VERSION_NUMBER__" |
| 5 | + export PACKAGE_VERSION=$(npm version patch) |
| 6 | + npm install -g documentation |
| 7 | + npm run doc |
| 8 | + fi |
10 | 9 |
|
11 | 10 | language: node_js |
12 | 11 | sudo: required |
13 | 12 | node_js: |
14 | 13 | - "stable" |
| 14 | + |
15 | 15 | # travis call prepare |
16 | 16 | # Send coverage data to Coveralls |
| 17 | +# Deploy terminusdb/terminus-client |
17 | 18 | after_script: |
18 | 19 | - npm run coveralls-after |
19 | 20 |
|
20 | 21 | branches: |
21 | 22 | only: |
22 | | - - dev |
23 | | - - master |
| 23 | + - clientBuild |
24 | 24 |
|
25 | | - before_deploy: |
26 | | - if ! [[ $TRAVIS_TAG ]]; then |
27 | | - export TRAVIS_TAG="1.$TRAVIS_BUILD_NUMBER" && |
28 | | - npm install -g documentation && |
29 | | - npm version patch && |
30 | | - npm run doc |
31 | | - # Set up git user name and tag this commit |
32 | | - git config --local user.name "Francesca-Bit" && |
33 | | - git config --local user.email "[email protected]" && |
34 | | - git add package.json && |
35 | | - git commit -m "version changed travis_build_number $TRAVIS_TAG" && |
36 | | - git push origin master && |
37 | | - npm run git-tag; |
38 | | - fi |
| 25 | +before_deploy: |
| 26 | + - | |
| 27 | + if [[ ! $TRAVIS_VAR ]]; then |
| 28 | + printf "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" >> ~/.npmrc |
| 29 | + npm run build |
| 30 | + echo "___TRAVIS_VAR____" |
| 31 | + export TRAVIS_VAR="1.$TRAVIS_BUILD_NUMBER" |
| 32 | +
|
| 33 | + git commit --amend -m "[skip travis] version changed $PACKAGE_VERSION" |
| 34 | + git push https://${GITHUB_TOKEN}@github.com/$TRAVIS_REPO_SLUG HEAD:$TRAVIS_BRANCH |
| 35 | + git tag -f -a "$PACKAGE_VERSION" -m "new version $PACKAGE_VERSION" |
| 36 | + export LAST_HASH=$(git ls-remote https://github.com/$TRAVIS_REPO_SLUG $TRAVIS_BRANCH | awk '{ print $1}') |
| 37 | + echo $LAST_HASH |
| 38 | + fi |
| 39 | +#https://blog.travis-ci.com/2018-04-11-how_to_publish_node_js_packages_with_travis_ci_and_packagecloud/ |
39 | 40 | deploy: |
40 | | - - provider: releases |
41 | | - api_key: $GITHUB_TOKEN |
42 | | - file: public_pages/dist/* |
43 | | - skip_cleanup: true |
44 | | - on: |
45 | | - branch: master |
46 | | - -provider: pages |
| 41 | + - provider: script |
47 | 42 | skip_cleanup: true |
48 | | - github_token: $GITHUB_TOKEN # Set in the settings page of your repository, as a secure variable |
49 | 43 | keep_history: true |
50 | | - local_dir: public_pages |
| 44 | + script: bash public_pages.sh |
| 45 | + on: |
| 46 | + branch: clientBuild |
| 47 | + condition: $TRAVIS_COMMIT_MESSAGE == *"[run deploy]"* |
| 48 | + - provider: releases |
| 49 | + target_commitish : $LAST_HASH |
| 50 | + keep_history: true |
| 51 | + api_key: $GITHUB_TOKEN |
| 52 | + skip_cleanup: true |
| 53 | + overwrite: true |
51 | 54 | on: |
52 | | - branch: master |
| 55 | + branch: clientBuild |
| 56 | + condition: $TRAVIS_COMMIT_MESSAGE == *"[run deploy]"* |
53 | 57 | - provider: npm |
54 | 58 | skip_cleanup: true |
55 | 59 | |
56 | | - api_key: "NPM_TOKEN" |
| 60 | + api_key: $NPM_TOKEN |
57 | 61 | keep_history: true |
58 | 62 | on: |
59 | | - branch : master |
| 63 | + branch : clientBuild |
| 64 | + condition: $TRAVIS_COMMIT_MESSAGE == *"[run deploy]"* |
0 commit comments