Skip to content

Commit 8cc0ecb

Browse files
froala-travis-botGangadhar
and
Gangadhar
authored
CICD changes (#113)
* CI/CD pipeline integration Co-authored-by: Gangadhar <[email protected]>
1 parent b0a837a commit 8cc0ecb

File tree

3 files changed

+93
-65
lines changed

3 files changed

+93
-65
lines changed

.travis.yml

+33-65
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,34 @@
1-
language: ruby
2-
cache: bundler
3-
rvm:
4-
- 1.9.3
5-
- 2.0.0
6-
- 2.1.0
7-
- 2.2.0
8-
- 2.2.2
9-
- 2.3.0
10-
- 2.4.0
11-
- 2.5.0
12-
- 2.6.0
13-
- 2.7.0
14-
gemfile:
15-
- gemfiles/rails4.gemfile
16-
- gemfiles/rails5.gemfile
17-
- gemfiles/rails6.gemfile
18-
- gemfiles/rails7.gemfile
1+
git:
2+
depth: false
3+
quiet: false
4+
language: generic
5+
dist: bionic
6+
sudo: required
7+
branches:
8+
only:
9+
- /dev*/
10+
- /AO-dev*/
11+
- /QA*/
12+
- /QE*/
13+
- /RC*/
14+
- /Release-Master*/
15+
16+
env:
17+
- SHORT_COMMIT= `git rev-parse --short=7 ${TRAVIS_COMMIT}`
18+
1919
before_install:
20-
- gem update bundler
21-
matrix:
22-
exclude:
23-
- rvm: 1.9.3
24-
gemfile: gemfiles/rails5.gemfile
25-
- rvm: 1.9.3
26-
gemfile: gemfiles/rails6.gemfile
27-
- rvm: 1.9.3
28-
gemfile: gemfiles/rails7.gemfile
29-
- rvm: 2.0.0
30-
gemfile: gemfiles/rails5.gemfile
31-
- rvm: 2.0.0
32-
gemfile: gemfiles/rails6.gemfile
33-
- rvm: 2.0.0
34-
gemfile: gemfiles/rails7.gemfile
35-
- rvm: 2.1.0
36-
gemfile: gemfiles/rails5.gemfile
37-
- rvm: 2.1.0
38-
gemfile: gemfiles/rails6.gemfile
39-
- rvm: 2.1.0
40-
gemfile: gemfiles/rails7.gemfile
41-
- rvm: 2.2.0
42-
gemfile: gemfiles/rails5.gemfile
43-
- rvm: 2.2.0
44-
gemfile: gemfiles/rails6.gemfile
45-
- rvm: 2.2.0
46-
gemfile: gemfiles/rails7.gemfile
47-
- rvm: 2.2.2
48-
gemfile: gemfiles/rails6.gemfile
49-
- rvm: 2.2.2
50-
gemfile: gemfiles/rails7.gemfile
51-
- rvm: 2.2.0
52-
gemfile: gemfiles/rails7.gemfile
53-
- rvm: 2.3.0
54-
gemfile: gemfiles/rails6.gemfile
55-
- rvm: 2.3.0
56-
gemfile: gemfiles/rails7.gemfile
57-
- rvm: 2.4.0
58-
gemfile: gemfiles/rails6.gemfile
59-
- rvm: 2.4.0
60-
gemfile: gemfiles/rails7.gemfile
61-
- rvm: 2.5.0
62-
gemfile: gemfiles/rails6.gemfile
63-
- rvm: 2.5.0
64-
gemfile: gemfiles/rails7.gemfile
65-
- rvm: 2.6.0
66-
gemfile: gemfiles/rails7.gemfile
20+
- echo $TRAVIS_BRANCH
21+
- echo $PWD
22+
- echo $TRAVIS_COMMIT
23+
- echo $BUILD_REPO_NAME
24+
jobs:
25+
include:
26+
if: commit_message =~ /(deploy-yes)/
27+
script:
28+
- chmod u+x build-push-to-nexus.sh && bash build-push-to-nexus.sh
29+
notifications:
30+
email:
31+
recipients:
32+
33+
on_success: always
34+
on_failure: always

build-push-to-nexus.sh

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/bin/bash
2+
3+
if [ ${TRAVIS_PULL_REQUEST} != "false" ]; then echo "Not publishing a pull request !!!" && exit 0; fi
4+
export BRANCH_NAME=`echo "${TRAVIS_BRANCH}" | tr '[:upper:]' '[:lower:]'`
5+
case "${BRANCH_NAME}" in
6+
dev*) echo "Branch ${TRAVIS_BRANCH} is eligible for CI/CD" ;;
7+
ao-dev*)echo "Branch ${TRAVIS_BRANCH} is eligible for CI/CD" ;;
8+
qa*) echo "Branch ${TRAVIS_BRANCH} is eligible for CI/CD" ;;
9+
qe*) echo "Branch ${TRAVIS_BRANCH} is eligible for CI/CD" ;;
10+
rc*) echo "Branch ${TRAVIS_BRANCH} is eligible for CI/CD" ;;
11+
release-master*) echo "Branch ${TRAVIS_BRANCH} is eligible for CI/CD" ;;
12+
ft*) echo "Branch ${TRAVIS_BRANCH} is eligible for CI" ;;
13+
bf*) echo "Branch ${TRAVIS_BRANCH} is eligible for CI" ;;
14+
*) echo "Not a valid branch name for CI/CD" && exit -1;;
15+
esac
16+
17+
echo $TRAVIS_BRANCH
18+
echo ${DEPLOYMENT_SERVER}
19+
export SHORT_COMMIT=`git rev-parse --short=7 ${TRAVIS_COMMIT}`
20+
echo "short commit $SHORT_COMMIT"
21+
sudo apt-get update && sudo apt-get install -y jq gem
22+
DEPENDENCIES=`cat wysiwyg-rails.gemspec | grep "gem.add_dependency"`
23+
sed -i -e "/.*end/d" wysiwyg-rails.gemspec
24+
echo ${DEPENDENCIES} >> wysiwyg-rails.gemspec
25+
echo "gem.metadata['allowed_push_host'] = 'https://nexus.tools.froala-infra.com/repository/Froala-rubygems-repo'" >> wysiwyg-rails.gemspec
26+
echo "end" >> wysiwyg-rails.gemspec
27+
echo "checking gemspecs file: "
28+
cat wysiwyg-rails.gemspec
29+
PACKAGE_NAME=`jq '.name' version.json | tr -d '"'`
30+
PACKAGE_VERSION=`jq '.version' version.json | tr -d '"'`
31+
wget --timeout=10 --no-check-certificate --user ${NEXUS_USER} --password ${NEXUS_USER_PWD} https://nexus.tools.froala-infra.com/repository/Froala-npm/${PACKAGE_NAME}/-/${PACKAGE_NAME}-${PACKAGE_VERSION}.tgz
32+
if [ $? -ne 0 ]; then
33+
echo "Error pulling core library from nexus"
34+
exit -1
35+
fi
36+
tar -xvf ${PACKAGE_NAME}-${PACKAGE_VERSION}.tgz
37+
echo "Copying core library css & js to app/assets/stylesheets/ & app/assets/javascripts/ ......"
38+
/bin/cp -fr package/css/* app/assets/stylesheets/
39+
/bin/cp -fr package/js/* app/assets/javascripts/
40+
echo "Done ..."
41+
rm -rf package/ ${PACKAGE_NAME}-${PACKAGE_VERSION}.tgz
42+
gem install nexus
43+
gem build wysiwyg-rails.gemspec
44+
GEM_NAME=`ls -A wysiwyg-rails*.gem `
45+
echo "Rails SDK gem filename $GEM_NAME"
46+
GEM_NAME2=""
47+
GEM_NAME2=`echo ${GEM_NAME} | awk -F'-' '{print $1}'`
48+
GEM_NAME2="${GEM_NAME2}-`echo ${GEM_NAME} | awk -F'-' '{print $2}'`"
49+
GEM_NAME2="${GEM_NAME2}-${TRAVIS_BRANCH}"
50+
GEM_NAME2="${GEM_NAME2}-`echo ${GEM_NAME} | awk -F'-' '{print $3}'`"
51+
echo "gem name : ${GEM_NAME2}"
52+
mv ${GEM_NAME} ${GEM_NAME2}
53+
NXS_PASS=`echo ${NEXUS_USER_PWD}`
54+
curl -k --user "${NEXUS_USER}:${NXS_PASS}" --upload-file ./${GEM_NAME2} https://nexus.tools.froala-infra.com/repository/Froala-raw-repo/rails/${GEM_NAME2}
55+
exit $?

version.json

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"comment-1": " Please update this file for any new branch with core libary name - package name and version uploaded to nexus",
3+
"name": "froala-editor-QA241122",
4+
"version": "4.0.16"
5+
}

0 commit comments

Comments
 (0)