Skip to content

Commit

Permalink
Make releases from version tags instead of release branches
Browse files Browse the repository at this point in the history
  • Loading branch information
indigo423 committed Oct 25, 2018
1 parent 36fa625 commit 562ea81
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 39 deletions.
41 changes: 9 additions & 32 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,11 @@ jobs:
name: Tag Docker Container Images and upload to DockerHub
command: |
source ${BASH_ENV}
case "${CIRCLE_BRANCH}" in
master)
docker tag pris:$(cat version.txt) ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:bleeding
docker push ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:bleeding
;;
release*)
docker tag pris:$(cat version.txt) ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:latest
docker tag pris:$(cat version.txt) ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:$(cat version.txt)
docker push ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:latest
docker push ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:$(cat version.txt)
;;
*)
echo "This is not a branch build which needs to be published"
;;
esac
docker tag pris:$(cat version.txt) ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:latest
docker tag pris:$(cat version.txt) ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:$(cat version.txt)
docker push ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:latest
docker push ${DOCKERHUB_PROJECT_USER}/${DOCKERHUB_PROJECT_NAME}:$(cat version.txt)
publish_github:
<<: *defaults
Expand All @@ -243,23 +233,10 @@ jobs:
- run:
name: Collect artifacts and publish archives to GitHub
command: |
case "${CIRCLE_BRANCH}" in
master)
mkdir github-bleeding
cp opennms-pris-dist/target/opennms-pris-release-archive.tar.gz github-bleeding/opennms-pris-bleeding-$(cat version.txt).tar.gz
cp opennms-pris-dist/target/opennms-pris-release-archive.zip github-bleeding/opennms-pris-bleeding-$(cat version.txt).zip
ghr -prerelease -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} bleeding-$(cat version.txt) github-bleeding
;;
release*)
mkdir github-latest
cp opennms-pris-dist/target/opennms-pris-release-archive.tar.gz github-latest/opennms-pris-release-$(cat version.txt).tar.gz
cp opennms-pris-dist/target/opennms-pris-release-archive.zip github-latest/opennms-pris-release-$(cat version.txt).zip
ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} $(cat version.txt) github-latest
;;
*)
echo "This is not a branch build which needs to be published"
;;
esac
mkdir github-latest
cp opennms-pris-dist/target/opennms-pris-release-archive.tar.gz github-latest/opennms-pris-release-$(cat version.txt).tar.gz
cp opennms-pris-dist/target/opennms-pris-release-archive.zip github-latest/opennms-pris-release-$(cat version.txt).zip
ghr -u ${CIRCLE_PROJECT_USERNAME} -r ${CIRCLE_PROJECT_REPONAME} $(cat version.txt) github-latest
workflows:
version: 2
Expand Down
10 changes: 3 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ The project is divided in the following Maven modules:

Docker Tags

* `bleeding` floating tag for a build from develop bleeding edge branch
* `latest` floating tag for a build from latest stable release
* to run a specific stable version see the [DockerHub Tag] section

Expand Down Expand Up @@ -148,10 +147,9 @@ docker run --name mypris --detach --publish 8000:8000 mypris

# Development and Releases

There are several other branches with the following naming convention:

* `master` branch for next release, tagged as `bleeding` on [DockerHub]
* `release-*` a specific stable release, tagged as `latest` and with specific version number from `git describe` as history on [DockerHub]
Releases are made from version tags without any prefixes.
Every new release will be tagged also as `latest` on DockerHub.
The specific version number is generated from `git describe`.

The branches above will be automatically published to [DockerHub].
All other branches are just built and tested.
Expand All @@ -170,5 +168,3 @@ The CI/CD workflows can be found in the `.circleci` directory.
[git-scm]: http://git-scm.com/
[yED]: http://www.yworks.com/en/products_yed_about.html
[Web Chat]: https://chats.opennms.org/opennms-discuss
[IRC]: irc://freenode.org/#opennms

0 comments on commit 562ea81

Please sign in to comment.