Skip to content
This repository was archived by the owner on Apr 26, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 27 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,30 @@
# Module for common Java code generation utilities
[![Build Status](https://travis-ci.org/ibm-developer/java-codegen-common.svg?branch=master)](https://travis-ci.org/ibm-developer/java-codegen-common/branches)
[![Travis][img-travis-master]][url-travis-master]
[![Coveralls][img-coveralls-master]][url-coveralls-master]
[![Version][img-version]][url-npm]
[![License][img-license]][url-npm]

You can see builds for all branches here [https://travis-ci.org/ibm-developer/java-codegen-common/branches](https://travis-ci.org/ibm-developer/java-codegen-common/branches).
[img-travis-master]: https://travis-ci.org/ibm-developer/java-codegen-common.svg?branch=master
[url-travis-master]: https://travis-ci.org/ibm-developer/java-codegen-common/branches

This is a module that contains common Java code generation libraries used by various Java generators.
[img-coveralls-master]: https://coveralls.io/repos/github/ibm-developer/java-codegen-common/badge.svg
[url-coveralls-master]: https://coveralls.io/github/ibm-developer/java-codegen-common

[url-npm]: https://www.npmjs.com/package/ibm-java-codegen-common
[img-license]: https://img.shields.io/npm/l/ibm-java-codegen-common.svg
[img-version]: https://img.shields.io/npm/v/ibm-java-codegen-common.svg

This is a module that contains common Java code generation libraries used by various Java generators.

# Contribution

In order to publish changes, you will need to fork the repository or ask to join the `ibm-developer` org and branch off the `master` branch.

Make sure to follow the [conventional commit specification](https://conventionalcommits.org/) before contributing. To help you with commit a commit template is provide.
Run `config.sh` to initialize the commit template to your `.git/config` or you can use

Once you are finished with your changes, run `npm test` to make sure all tests pass.

Do a pull request against `master`, make sure the build passes. A team member will review and merge your pull request.
Once merged to `master` one pull request will be created against `master`. Make sure that the CHANGELOG.md and the package.json is correct before merging the auto generated pull request. After the autogenerated
pull request has been merged to `master` the version will be bumped and published to npm.
21 changes: 5 additions & 16 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,18 @@ echo "Checking if a new publish cycle is required ..."
PKG_NAME=`node -e "console.log(require('./package.json').name);"`
PKG_VER=`node -e "console.log(require('./package.json').version);"`
NPM_VER=`npm show $PKG_NAME version --silent`
CHECK_REG=$(curl https://registry.npmjs.org/$PKG_NAME)
NOT_FOUND=$(node -e "console.log(Object.keys(JSON.parse(JSON.stringify($CHECK_REG))).length)")

echo "$PKG_NAME : version = $PKG_VER, npm version = $NPM_VER"
if [[ $TRAVIS_BRANCH == "master" ]]; then
echo "Build targetting master - checking if this is a PR or not"
if [[ $TRAVIS_PULL_REQUEST == "false" ]]; then
echo "This is a build on master, performing additional steps"
if [ $NOT_FOUND == 0 ]; then
echo "$PKG_NAME is not in public registry so going to publish"
npm publish
elif [[ $PKG_VER == $NPM_VER ]]; then
if [[ $PKG_VER == $NPM_VER ]]; then
echo "Version numbers match, so changing version and committing changes"
npm run prerelease
if [ $? == 0 ]; then
#If you are running a protected master branch then you *could* disable re-running the tests
echo "Tests passed, continuing release cycle"
../prerelease.sh
if [ $? != 0 ]; then
exit $?
fi
else
exit $?
../prerelease.sh
retval=$?
if [ $retval != 0 ]; then
exit $retval
fi
else
echo "Version numbers don't match, so publishing to the registry"
Expand Down
14 changes: 1 addition & 13 deletions npm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,4 @@
[img-codacy]: https://api.codacy.com/project/badge/Grade/a5893a4622094dc8920c8a372a8d3588?branch=development
[url-codacy]: https://www.codacy.com/app/ibm-developer/java-codegen-common


# Contribution

In order to publish changes, you will need to fork the repository or ask to join the `ibm-developer` org and branch off the `master` branch.

Make sure to follow the [conventional commit specification](https://conventionalcommits.org/) before contributing. To help you with commit a commit template is provide.
Run `config.sh` to initialize the commit template to your `.git/config` or you can use

Once you are finished with your changes, run `npm test` to make sure all tests pass.

Do a pull request against `master`, make sure the build passes. A team member will review and merge your pull request.
Once merged to `master` one pull request will be created against `master`. Make sure that the CHANGELOG.md and the package.json is correct before merging the auto generated pull request. After the autogenerated
pull request has been merged to `master` the version will be bumped and published to npm.
This is a module that contains common Java code generation libraries used by various IBM Java generators. For more information and to contribute see the [GitHub Repository](https://github.com/ibm-developer/java-codegen-common).
23 changes: 16 additions & 7 deletions prerelease.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,29 @@
#!/usr/bin/env bash
git config user.email "travisci@travis.ibm.com"
git config user.name "Travis CI"
git config push.default simple

echo "Running smoke test"
npm run prerelease
retval=$?
if [ $retval != 0 ]; then
exit $retval
fi
echo "Upgrading using standard-version"
npm run release
if [ $? != 0 ]; then
exit $?
retval=$?
if [ $retval != 0 ]; then
exit $retval
fi
echo "Creating git branch"

echo "Determining next version"
PKG_VER_NEXT=`node -e "console.log(require('./package.json').version);"`

echo "Creating git branch"
BRANCH="updateTo${PKG_VER_NEXT}"
git checkout -b $BRANCH

git status
git commit -m "Update test coverage and code scan files"
# this pull request through this branch will be needed to be reviewed as usual
git remote rm origin
git remote add origin $GITHUB_URL_SECURED
git push --follow-tags origin master
git push --follow-tags origin $BRANCH
hub pull-request -b master -m "chore: Merging CHANGELOG and package.json changes"