forked from kee-org/browser-addon
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.travis.yml
More file actions
111 lines (103 loc) · 7.2 KB
/
.travis.yml
File metadata and controls
111 lines (103 loc) · 7.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
language: node_js
node_js:
- "10"
cache:
directories:
- "$HOME/.npm"
sudo: false
# This is needed to avoid building all the tags pushed by travis
branches:
except:
- /^v?\d+\.\d+\.\d+$/
# Build customisation
#
# Some build stages trigger build failure if any script/entry returns a non-zero value, others don't.
# Notably these do but there may be others:
# before_install
# install
# before_deploy
# script
before_install:
- test $TRAVIS_BRANCH != "master" -o $TRAVIS_PULL_REQUEST != "false" || { echo "Running a master branch build..."; }
- 'test $(expr $TRAVIS_BRANCH : "release/.*") -eq 0 -o $TRAVIS_PULL_REQUEST != "false" || { echo "Running a release branch build..."; }'
# Travis has an old version of npm and we need the latest to enable dependency locking
- npm install -g npm@'>=5.7.1'
# Create a git tag of the new version to use
# If manifest.json major and minor versions match last tag, then increment last tag. Else use manifest.json major.minor.0.
- "KEE_VERSION_MANIFEST=`sed -nE 's/^.*\"version\": \"([0-9]{1,}\\.[0-9]{1,})\\.[0-9x]{1,}\"\\,/\\1/p' manifest.json | tr -d '\\040\\011\\012\\015'`; KEE_VERSION_TAG=`git describe --abbrev=0 --tags | sed -E 's/^([0-9]{1,}\\.[0-9]{1,})\\.([0-9]{1,})$/\\1 \\2/g'`; echo \"${KEE_VERSION_MANIFEST} ${KEE_VERSION_TAG}\" | awk '{printf($1==$2?\"\"$2\".\"$3+1:\"\"$1\".0\")}' | xargs -I {} git tag -a {} -m \"{}\"\n"
# Update manifest.json based on the git tag we just created
- NEW_KEE_VERSION=`git describe --abbrev=0 --tags`
- "sed -E 's/^(.*\"version\": \")(.*)(\"\\,.*)/\\1'\"$NEW_KEE_VERSION\"'\\3/' manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json"
- "sed -E 's/^(.*\"version_name\": \")(.*)(\"\\,.*)/\\1'\"$NEW_KEE_VERSION\"'\\3/' manifest.json > manifest.json.tmp && mv manifest.json.tmp manifest.json"
install:
- npm ci
script: npm run package:prod && npm run package:debug
# push any source changes for localisation
#
# There's some kinda backwards logic here because we need to ensure we only
# return a non-zero exit code if the push transifex is attempted and fails
# (technically this section doesn't require the non-zero exit code but other
# sections do so this keeps the logic consistent with other similar tests
# elsewhere in the build chain)
after_success:
- test $TRAVIS_BRANCH != "master" -o $TRAVIS_PULL_REQUEST != "false" || { virtualenv ~/env && source ~/env/bin/activate && pip install transifex-client && echo $'[https://www.transifex.com]\nhostname = https://www.transifex.com\nusername = api\ntoken = \npassword = '"$TRANSIFEX_API_TOKEN"$'\n' > .transifexrc && tx -d --traceback push -s; }
- echo "Manifest used for build..."
- cat manifest.json
# Ensure we have suitable authentication for pushing git changes when necessary
# Sign the new beta release and prepare the auto-update data if we're on a release branch (weird logic per explanation for after_success)
before_deploy:
- >
if ! [ "$BEFORE_DEPLOY_HAS_RAN" ]; then
export BEFORE_DEPLOY_HAS_RAN=1;
git config --global user.email "travis@travis-ci.org"
git config --global user.name "Travis CI"
git config credential.helper "store --file=.git/credentials"
echo "https://${GH_TOKEN}:@github.com" > .git/credentials
pwd
ls prepareBetaRelease.sh
ls ./prepareBetaRelease.sh
test $(expr $TRAVIS_BRANCH : "release/.*") -eq 0 -o $TRAVIS_PULL_REQUEST != "false" || { chmod 755 ./prepareBetaRelease.sh && ./prepareBetaRelease.sh; }
echo "before_deploy complete"
fi
# Push the new tag back to GitHub and upload artifacts but only if on the master or a release branch
deploy:
- provider: script
skip_cleanup: true
script: git push --tags
on:
branch: master
- provider: script
skip_cleanup: true
script: git push --tags
on:
all_branches: true
condition: $TRAVIS_PULL_REQUEST = "false" && $TRAVIS_BRANCH =~ ^release/
# Push the unsigned files to a new GitHub release
- provider: releases
api_key:
secure: "DC8qtOkMdII1bYL8UZdVuEJNFfk7pywLIA93F7O6y8ruWt2N23c1grC0l0kmWjFKAyjv5pILddLm5FPpEaN5tRWd3ROHjmP/kXRaY0vSsrUD6bIFHbIg6rouenfVZo9L5jtyzJQKABZABWmqFcKdE+qmpOlO6aAgwDHdl0Ai+zhBU8mHsVv5y2yqjBGTyXpBNVEtPEMetfJSq0fq6U/LOhyWn/dGCiHdA7pmvznQ6Uiu8ShNAJiRq47tlD0cGLQSpFbKGWoJlxGIecHkDJDfE4V4gmS7rrGp50Y9TbFmxFxGnNxwRCWAL1usp0yDjliIYkzl0bNrw2MRSTz+vgMAYjwwUHb0VgCciRDorJplJGmcN2S7UrpcaffL7b5MDpn9wfKSOvPLsPqhGpRudB9/v6KawhcKZ5dOLQgfup5kjV/WuWG9BgeDFN7S9/Tzw9EUD6tuou+duzlu+QSjNkUrAxuWdnpC7QgVxIVkXdD7qdmDzb34jkJhEF5Gk6XY52Yyiy+GDjkfP03QV5qk7nRXaUu9FI/OWMuSyC6ru6VyCABoKCV0o8kbcPVjIl9yJM8+5t4+RBQj/Saohgm+t2gZhgeFgE9N2Sj3pcp8+iaurlcFJI8DLIBwsNpJXFlLIwZoq0/SOkXIUmilhkEntWy9ctj8LSX47GobAScneRY99+w="
file_glob: true
file: dist/*
skip_cleanup: true
prerelease: true
body: "This is an automatically generated pre-release. Some releases will be thoroughly tested and their derivatives marked as ready for beta and eventually stable release. If the status of this version changes, this message will be replaced. You may want to install the files in this release if you wish to test a specific change that is included within this version. More information can be found at https://forum.kee.pm/t/versioning-and-releases/550"
on:
branch: master
# Push the signed and unsigned files to a new GitHub release
- provider: releases
api_key:
secure: "DC8qtOkMdII1bYL8UZdVuEJNFfk7pywLIA93F7O6y8ruWt2N23c1grC0l0kmWjFKAyjv5pILddLm5FPpEaN5tRWd3ROHjmP/kXRaY0vSsrUD6bIFHbIg6rouenfVZo9L5jtyzJQKABZABWmqFcKdE+qmpOlO6aAgwDHdl0Ai+zhBU8mHsVv5y2yqjBGTyXpBNVEtPEMetfJSq0fq6U/LOhyWn/dGCiHdA7pmvznQ6Uiu8ShNAJiRq47tlD0cGLQSpFbKGWoJlxGIecHkDJDfE4V4gmS7rrGp50Y9TbFmxFxGnNxwRCWAL1usp0yDjliIYkzl0bNrw2MRSTz+vgMAYjwwUHb0VgCciRDorJplJGmcN2S7UrpcaffL7b5MDpn9wfKSOvPLsPqhGpRudB9/v6KawhcKZ5dOLQgfup5kjV/WuWG9BgeDFN7S9/Tzw9EUD6tuou+duzlu+QSjNkUrAxuWdnpC7QgVxIVkXdD7qdmDzb34jkJhEF5Gk6XY52Yyiy+GDjkfP03QV5qk7nRXaUu9FI/OWMuSyC6ru6VyCABoKCV0o8kbcPVjIl9yJM8+5t4+RBQj/Saohgm+t2gZhgeFgE9N2Sj3pcp8+iaurlcFJI8DLIBwsNpJXFlLIwZoq0/SOkXIUmilhkEntWy9ctj8LSX47GobAScneRY99+w="
file_glob: true
file: "dist/**/*.{xpi,zip}"
skip_cleanup: true
body: "This is an automatically generated beta release. The first beta release for this major.minor version has been thoroughly tested; subsequent releases typically contain only new translations and occasional critical fixes with very limited scope. After beta testing this release may be promoted to a stable release. This message will be replaced if that happens. More information can be found at https://forum.kee.pm/t/versioning-and-releases/550 . To install this beta version into Firefox, make sure you select the signed .xpi file - not all the listed .xpi files are signed and a typical Firefox configuration will reject the unsigned versions. The exact name may vary but will contain the word beta and the file size will be slightly larger than the other .xpi files."
on:
all_branches: true
condition: $TRAVIS_PULL_REQUEST = "false" && $TRAVIS_BRANCH =~ ^release/
# Then publish the new release to existing users
- provider: script
skip_cleanup: true
script: echo "Pushing update file" && cd $TRAVIS_BUILD_DIR/../browser-addon-updates && git push && cd -
on:
all_branches: true
condition: $TRAVIS_PULL_REQUEST = "false" && $TRAVIS_BRANCH =~ ^release/