Skip to content

Commit

Permalink
Automated release process to avoid disasters like #2
Browse files Browse the repository at this point in the history
  • Loading branch information
holgerbrandl committed Mar 27, 2019
1 parent 841853a commit b88ad5c
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 6 deletions.
47 changes: 41 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
group = 'com.github.holgerbrandl'
version = '1.4'

buildscript {
ext.kotlin_version = '1.1.60'
ext.kotlin_version = '1.2.70'

repositories {
mavenCentral()
Expand All @@ -13,16 +10,22 @@ buildscript {
}
}

plugins { id "com.jfrog.bintray" version "1.8.1" }

apply plugin: 'java'
//apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'maven-publish'


repositories {
mavenCentral()
jcenter()
}

group = 'com.github.holgerbrandl'
version = '1.4'

// should not be needed
//dependencies {
// compileOnly "org.jetbrains.kotlin:kotlin-stdlib"
Expand All @@ -48,8 +51,40 @@ publishing {
maven(MavenPublication) {
from components.java
artifact sourcesJar { classifier "sources" }
artifact javadocJar
// artifactId = 'kscript-annotations'
}
}
}


if (hasProperty('bintray_user') && hasProperty('bintray_key')) {
bintray {

// property must be set in ~/.gradle/gradle.properties
user = bintray_user
key = bintray_key

publications = ['maven'] //When uploading configuration files

dryRun = false //Whether to run this as dry-run, without deploying
publish = true // If version should be auto published after an upload

pkg {
repo = 'github'
name = 'kscript-annotations'
vcsUrl = 'https://github.com/holgerbrandl/kscript-annotations'

licenses = ['MIT']
publicDownloadNumbers = true

artifactId = 'kscript-annotations'
//Optional version descriptor
version {
name = project.version //Bintray logical version name
desc = '.'
released = new Date()
vcsTag = 'v' + project.version
}
}
}
}
53 changes: 53 additions & 0 deletions release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

##
## Release Steps For new Annotation Support Libary Version
##

export KANNOT_HOME="/d/projects/misc/kscript-annotations";

trim() { while read -r line; do echo "$line"; done; }
annot_version=$(grep '^version' ${KANNOT_HOME}/build.gradle | cut -f3 -d' ' | tr -d "'" | trim)

echo "new version is $annot_version"

### Do the github release
## see https://github.com/aktau/github-release

#source /Users/brandl/archive/gh_token.sh
source ~/archive/gh_token.sh
export GITHUB_TOKEN=${GH_TOKEN}
#echo $GITHUB_TOKEN

# make your tag and upload
cd ${KANNOT_HOME}

## make sure we have not pending commits
(git diff --ignore-submodules --exit-code && git tag "v${annot_version}") || echo "could not tag current branch"

## make sure all local changes become public
git push --tags

# check the current tags and existing releases of the repo
# binaries are located under $GOPATH/bin
export PATH=~/go/bin/:$PATH

github-release info -u holgerbrandl -r kscript-annotations

# create a formal release
github-release release \
--user holgerbrandl \
--repo kscript-annotations \
--tag "v${annot_version}" \
--name "v${annot_version}" \
--description "See [NEWS.md](https://github.com/holgerbrandl/kscript/blob/master/NEWS.md) for changes."
# --pre-release


########################################################################
### Build and publish the binary release to jcenter

gradle install

# careful with this one!
gradle bintrayUpload

0 comments on commit b88ad5c

Please sign in to comment.