Skip to content

Commit b88ad5c

Browse files
committed
Automated release process to avoid disasters like #2
1 parent 841853a commit b88ad5c

File tree

2 files changed

+94
-6
lines changed

2 files changed

+94
-6
lines changed

build.gradle

+41-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
group = 'com.github.holgerbrandl'
2-
version = '1.4'
3-
41
buildscript {
5-
ext.kotlin_version = '1.1.60'
2+
ext.kotlin_version = '1.2.70'
63

74
repositories {
85
mavenCentral()
@@ -13,16 +10,22 @@ buildscript {
1310
}
1411
}
1512

13+
plugins { id "com.jfrog.bintray" version "1.8.1" }
1614

17-
apply plugin: 'java'
15+
//apply plugin: 'java'
1816
apply plugin: 'kotlin'
17+
apply plugin: 'maven'
1918
apply plugin: 'maven-publish'
2019

2120

2221
repositories {
2322
mavenCentral()
23+
jcenter()
2424
}
2525

26+
group = 'com.github.holgerbrandl'
27+
version = '1.4'
28+
2629
// should not be needed
2730
//dependencies {
2831
// compileOnly "org.jetbrains.kotlin:kotlin-stdlib"
@@ -48,8 +51,40 @@ publishing {
4851
maven(MavenPublication) {
4952
from components.java
5053
artifact sourcesJar { classifier "sources" }
54+
artifact javadocJar
55+
// artifactId = 'kscript-annotations'
56+
}
57+
}
58+
}
59+
60+
61+
if (hasProperty('bintray_user') && hasProperty('bintray_key')) {
62+
bintray {
63+
64+
// property must be set in ~/.gradle/gradle.properties
65+
user = bintray_user
66+
key = bintray_key
67+
68+
publications = ['maven'] //When uploading configuration files
69+
70+
dryRun = false //Whether to run this as dry-run, without deploying
71+
publish = true // If version should be auto published after an upload
72+
73+
pkg {
74+
repo = 'github'
75+
name = 'kscript-annotations'
76+
vcsUrl = 'https://github.com/holgerbrandl/kscript-annotations'
77+
78+
licenses = ['MIT']
79+
publicDownloadNumbers = true
5180

52-
artifactId = 'kscript-annotations'
81+
//Optional version descriptor
82+
version {
83+
name = project.version //Bintray logical version name
84+
desc = '.'
85+
released = new Date()
86+
vcsTag = 'v' + project.version
87+
}
5388
}
5489
}
5590
}

release.sh

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
#!/usr/bin/env bash
2+
3+
##
4+
## Release Steps For new Annotation Support Libary Version
5+
##
6+
7+
export KANNOT_HOME="/d/projects/misc/kscript-annotations";
8+
9+
trim() { while read -r line; do echo "$line"; done; }
10+
annot_version=$(grep '^version' ${KANNOT_HOME}/build.gradle | cut -f3 -d' ' | tr -d "'" | trim)
11+
12+
echo "new version is $annot_version"
13+
14+
### Do the github release
15+
## see https://github.com/aktau/github-release
16+
17+
#source /Users/brandl/archive/gh_token.sh
18+
source ~/archive/gh_token.sh
19+
export GITHUB_TOKEN=${GH_TOKEN}
20+
#echo $GITHUB_TOKEN
21+
22+
# make your tag and upload
23+
cd ${KANNOT_HOME}
24+
25+
## make sure we have not pending commits
26+
(git diff --ignore-submodules --exit-code && git tag "v${annot_version}") || echo "could not tag current branch"
27+
28+
## make sure all local changes become public
29+
git push --tags
30+
31+
# check the current tags and existing releases of the repo
32+
# binaries are located under $GOPATH/bin
33+
export PATH=~/go/bin/:$PATH
34+
35+
github-release info -u holgerbrandl -r kscript-annotations
36+
37+
# create a formal release
38+
github-release release \
39+
--user holgerbrandl \
40+
--repo kscript-annotations \
41+
--tag "v${annot_version}" \
42+
--name "v${annot_version}" \
43+
--description "See [NEWS.md](https://github.com/holgerbrandl/kscript/blob/master/NEWS.md) for changes."
44+
# --pre-release
45+
46+
47+
########################################################################
48+
### Build and publish the binary release to jcenter
49+
50+
gradle install
51+
52+
# careful with this one!
53+
gradle bintrayUpload

0 commit comments

Comments
 (0)