-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add build scripts. Add CircleCI config. Add maven settings for ossrh …
…server.
- Loading branch information
1 parent
cd38de2
commit a4c1495
Showing
4 changed files
with
184 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
version: 2 | ||
jobs: | ||
build: | ||
# directory where steps will run | ||
working_directory: ~/commons-lang | ||
docker: | ||
- image: daniloarcidiacono/ci-java-node:0.4.0 | ||
|
||
steps: | ||
# check out source code to working directory | ||
- checkout | ||
|
||
# restore the saved cache after the first run or if `pom.xml` has changed | ||
- restore_cache: | ||
key: commons-lang-{{ checksum "pom.xml" }} | ||
|
||
# gets the project dependencies | ||
- run: mvn dependency:go-offline | ||
|
||
# saves the project dependencies | ||
- save_cache: | ||
paths: | ||
- ~/.m2 | ||
key: commons-lang-{{ checksum "pom.xml" }} | ||
|
||
# Build | ||
- run: mvn clean package verify -Pdocs | ||
|
||
# Deploy | ||
- deploy: | ||
name: "Create GitHub release" | ||
command: | | ||
hub release create -a target/commons-lang-$CIRCLE_TAG-javadoc.jar -F CHANGELOG_LATEST.md $CIRCLE_TAG | ||
# uploads the test metadata from the `target/surefire-reports` directory so that it can show up in the CircleCI dashboard. | ||
- store_test_results: | ||
path: target/surefire-reports | ||
|
||
# store the jar as an artifact | ||
- store_artifacts: | ||
path: target/commons-lang-{{ .Environment.CIRCLE_TAG }}.jar | ||
|
||
workflows: | ||
version: 2 | ||
build_and_deploy: | ||
jobs: | ||
- build: | ||
filters: | ||
tags: | ||
only: /.*/ | ||
branches: | ||
ignore: /.*/ | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 | ||
https://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||
<servers> | ||
<server> | ||
<id>ossrh</id> | ||
<username>${ossrh.username}</username> | ||
<password>${ossrh.password}</password> | ||
</server> | ||
</servers> | ||
</settings> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check that we are in the root folder | ||
if ! [[ -f "./scripts/prepare-release.sh" ]]; then | ||
(>&2 echo "Script must be run from the root folder, actual $(pwd)") | ||
exit 1 | ||
fi | ||
|
||
# Get the current branch | ||
branch_name=$(git symbolic-ref -q HEAD) | ||
branch_name=${branch_name##refs/heads/} | ||
branch_name=${branch_name:-HEAD} | ||
|
||
# Check that we are in master | ||
if [[ ${branch_name} != 'master' ]]; then | ||
(>&2 echo "Releases can be prepared only on master branch, current one is ${branch_name}!") | ||
exit 1 | ||
fi | ||
|
||
# Check the arguments | ||
if [[ "$#" -ne 1 ]]; then | ||
(>&2 echo "Invalid number of arguments, found $#, expected 1") | ||
echo "prepare-release <new-version>" | ||
exit 1 | ||
fi | ||
|
||
# Fetch (for picking tags) | ||
git fetch | ||
existing_tag=$(git tag --list | grep $1 | wc -l) | ||
if [[ ${existing_tag} -gt 0 ]]; then | ||
(>&2 echo "Tag $1 already exists, stop.") | ||
exit 1 | ||
fi | ||
|
||
# Merge | ||
echo "Merging from dev" | ||
git merge origin/dev --no-ff --no-commit | ||
|
||
# Check if there are any conflicts | ||
conflicts=$(git ls-files -u | wc -l) | ||
if [[ ${conflicts} -gt 0 ]]; then | ||
(>&2 echo "There are merge conflicts, stop (use git merge --abort to undo changes).") | ||
exit 1 | ||
fi | ||
|
||
# Update the version | ||
echo "Setting project version to $1" | ||
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$1 | ||
|
||
# Compile with tests | ||
mvn clean verify | ||
|
||
if [[ $? -ne 0 ]]; then | ||
(>&2 echo "Project build failed, stop (use git merge --abort to undo changes).") | ||
exit 1 | ||
fi | ||
|
||
# Success: commit and tag | ||
echo "Build success, creating tagged commit" | ||
git commit -am "chore: version $1" | ||
git tag -a $1 -m "$1" | ||
|
||
# Ready to push! | ||
# git push origin master --tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Check that we are in the root folder | ||
if ! [[ -f "./scripts/start-next-iteration.sh" ]]; then | ||
(>&2 echo "Script must be run from the root folder, actual $(pwd)") | ||
exit 1 | ||
fi | ||
|
||
# Get the current branch | ||
branch_name=$(git symbolic-ref -q HEAD) | ||
branch_name=${branch_name##refs/heads/} | ||
branch_name=${branch_name:-HEAD} | ||
|
||
# Check that we are in dev | ||
if [[ ${branch_name} != 'dev' ]]; then | ||
(>&2 echo "Next iterations can be started only on dev branch, current one is ${branch_name}!") | ||
exit 1 | ||
fi | ||
|
||
# Check the arguments | ||
if [[ "$#" -ne 1 ]]; then | ||
(>&2 echo "Invalid number of arguments, found $#, expected 1") | ||
echo "start-next-iteration <new-version>" | ||
exit 1 | ||
fi | ||
|
||
# Check that the working tree is clean | ||
if [[ -n $(git status -s) ]]; then | ||
(>&2 echo "Working tree is not clean, stop") | ||
exit 1 | ||
fi | ||
|
||
# Update | ||
git fetch | ||
|
||
# Try to fast forward the dev branch | ||
git merge origin/dev --ff-only | ||
|
||
# Check for no conflicts | ||
if [[ $? -ne 0 ]]; then | ||
(>&2 echo "There are remote changes in dev branch that could not be merged automatically, stop.") | ||
exit 1 | ||
fi | ||
|
||
# Change the version | ||
echo "Setting project version to $1" | ||
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=$1 | ||
|
||
# Success: commit | ||
echo "Success, creating commit" | ||
git commit -am "chore: start next development iteration ($1)" | ||
|
||
# Ready to push! | ||
#git push origin dev |