Skip to content

Commit 976f831

Browse files
committed
Reorganised release process.
Release process is automated in following way: 1) with every build, we update files with appropriate version number before we deploy 2) when build is executed on a branch named `release/v1.2.3-something` then additional steps are taken: - project version in files: `sonar-project.properties`, `VERSION` is updated from the version number derived from release branch - changes on those two files are committed and and pushed - this should happen only once, when the release branch is initially created on the main repo 3) To create a release, just create a tag on the code to be released. The tag name must match the regex pattern: `^v[0-9]+\.[0-9]+\.[0-9]+.*$` - When a tag build is executed, the documentation is built and files are uploaded to the tag. - The version number is derived from the tag name.
1 parent abcb946 commit 976f831

20 files changed

+124
-63
lines changed

.gitattributes

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,2 @@
1-
.gitattributes export-ignore
2-
.gitignore export-ignore
3-
.gitmodules export-ignore
4-
.travis.yml export-ignore
5-
mkdocs.yml export-ignore
6-
.travis export-ignore
7-
sonar-project.properties export-ignore
8-
^tests/* export-ignore
9-
^development/* export-ignore
10-
^docs/* linguist-documentation
1+
* export-ignore
2+
^docs/* linguist-documentation

.gitattributes.release

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
.gitattributes export-ignore
2+
.gitignore export-ignore
3+
.gitmodules export-ignore
4+
.travis.yml export-ignore
5+
mkdocs.yml export-ignore
6+
.travis export-ignore
7+
sonar-project.properties export-ignore
8+
tests export-ignore
9+
development export-ignore
10+
node_modules export-ignore
11+
^docs/* linguist-documentation

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ pages/
1010
release/
1111
*.gz
1212
*.zip
13+
node_modules/

.travis.yml

Lines changed: 32 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,15 @@ env:
2525
- UT3_USER=ut3_user
2626
- UT3_USER_PASSWORD=ut3
2727
- UT3_TABLESPACE=users
28+
# Environment for building a release
29+
- CURRENT_BRANCH=${TRAVIS_BRANCH}
30+
- UTPLSQL_REPO="utPLSQL/utPLSQL"
31+
- UTPLSQL_BUILD_NO="${TRAVIS_BUILD_NUMBER:-0}"
32+
- UTPLSQL_VERSION_PLACEHOLDER='utPLSQL - Version'
33+
- UTPLSQL_VERSION=$(. .travis/get_project_version.sh)
34+
- UTPLSQL_BUILD_VERSION=$(. .travis/get_project_build_version.sh)
35+
- UTPLSQL_SOURCES_DIR='source'
36+
- UTPLSQL_BUILD_USER_NAME="Travis CI"
2837
# Target Branch and Directory for Deployment of Docs
2938
- PAGES_TARGET_BRANCH="gh-pages"
3039
- PAGES_VERSION_BASE="version3"
@@ -46,27 +55,39 @@ cache:
4655
install:
4756
- pip install mkdocs
4857
- bash .travis/install_sqlcl.sh
49-
- bash .travis/start_db.sh
58+
- if [ "${TRAVIS_TAG}" = "" ]; then bash .travis/start_db.sh; fi
59+
60+
before_script:
61+
#The update_project_version is done before deployment to validate that the change of project files does not break installation
62+
- bash .travis/update_project_version.sh
63+
- git config --global user.email "builds@travis-ci.com"
64+
- git config --global user.name "${UTPLSQL_BUILD_USER_NAME}"
65+
- git remote rm origin
66+
- git remote add origin https://${github_api_token}@github.com/${UTPLSQL_REPO}
5067

5168
script:
52-
- bash .travis/install.sh
53-
- bash .travis/run_examples_and_tests.sh
54-
# - bash .travis/run_test_as_user.sh
55-
# - bash .travis/build_docs.sh
56-
# - bash .travis/push_docs_to_gh_pages.sh
57-
- sonar-scanner
58-
- bash .travis/coveralls_uploader.sh
69+
- if [ "${TRAVIS_TAG}" = "" ]; then bash .travis/install.sh; fi
70+
- if [ "${TRAVIS_TAG}" = "" ]; then bash .travis/run_examples_and_tests.sh; fi
71+
- if [ "${TRAVIS_TAG}" = "" ]; then sonar-scanner; fi
72+
- if [ "${TRAVIS_TAG}" = "" ]; then bash .travis/coveralls_uploader.sh; fi
73+
- bash .travis/build_docs.sh
74+
- if [ "${TRAVIS_TAG}" = "" ]; then bash .travis/push_release_version.sh; fi
75+
76+
before_deploy:
77+
- bash .travis/build_release_archive.sh
5978

6079
deploy:
6180
provider: releases
6281
api_key: $github_api_token
6382
file:
64-
- utPLSQL$TRAVIS_TAG.zip
65-
- utPLSQL$TRAVIS_TAG.tar.gz
83+
- utPLSQL${UTPLSQL_BUILD_VERSION}.zip
84+
- utPLSQL${UTPLSQL_BUILD_VERSION}.tar.gz
6685
skip_cleanup: true
6786
on:
68-
repo: utPLSQL/utPLSQL
87+
repo: ${UTPLSQL_REPO}
6988
tags: true
89+
# when building from a release tag, use only first job "#xxx.1" to publish artifacts
90+
condition: "${TRAVIS_JOB_NUMBER} =~ \\.1$"
7091

7192
notifications:
7293
slack: utplsql:oiMuXO95TvKeAUENuDt4cPrB

.travis/build_release_archive.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/bin/bash
2+
3+
mv -f .gitattributes.release .gitattributes
4+
git add .
5+
git commit -m "tmp commit for building a release archive"
6+
7+
git archive --prefix="utPLSQL${UTPLSQL_BUILD_VERSION}"/ -o "utPLSQL${UTPLSQL_BUILD_VERSION}".zip --format=zip HEAD
8+
git archive --prefix="utPLSQL${UTPLSQL_BUILD_VERSION}"/ -o "utPLSQL${UTPLSQL_BUILD_VERSION}".tar.gz --format=tar.gz HEAD
9+
10+

.travis/create_release.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
cd "${0%/*}"
44
chmod +x ./build_docs.sh
55
chmod +x ./create_release_archive.sh
6-
./build_docs.sh
7-
./create_release_archive.sh
6+
7+
bash ./build_docs.sh
8+
bash ./create_release_archive.sh

.travis/create_release_archive.sh

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/usr/bin/env bash
2+
echo `sed -r "s/(v?[0-9]+\.)([0-9]+\.)([0-9]+)(-.*)/\1\2\3\.${UTPLSQL_BUILD_NO}\4/" <<< "${UTPLSQL_VERSION}"`

.travis/get_project_version.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#!/usr/bin/env bash
2+
#If building a new version from a release branch - then version is taken from release branch name
3+
if [[ "${CURRENT_BRANCH}" =~ ^release/v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
4+
version=${CURRENT_BRANCH#release\/}
5+
elif [[ "${TRAVIS_TAG}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+.*$ ]]; then
6+
version=${TRAVIS_TAG}
7+
else
8+
version=`cat VERSION`
9+
fi
10+
echo ${version}

.travis/install_libraries.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

0 commit comments

Comments
 (0)