Skip to content

Commit

Permalink
Automate Releases Using Travis CI and Github Releases
Browse files Browse the repository at this point in the history
Add Travis CI config with github release support.
This should upload artifacts to GitHub release after
a tag is pushed to the repo. A way to automate the release.
It also makes builds on every branch that gets a commit push.

Add information on how to make a release for the project. This
is a separate markdown file detailing the procedure.
  • Loading branch information
eyedol committed Jan 8, 2018
1 parent 33fc173 commit 9d9c418
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 6 deletions.
28 changes: 28 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
language: android
android:
components:
- tools
- platform-tools
# Note that the tools section appears twice on purpose as it’s required to get the newest Android SDK tools.
# See: https://docs.travis-ci.com/user/languages/android/#Overview
- tools
- build-tools-27.0.2
- build-tools-26.0.2
- android-27
- android-26
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
before_script:
- export VERSION_TO_BUILD="$TRAVIS_TAG"
script: ./gradlew clean build
deploy:
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
file: usbserial/build/outputs/aar/usbserial-${VERSION_TO_BUILD}-release.aar
skip_cleanup: true
on:
tags: true
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UsbSerial [![](https://jitpack.io/v/felHR85/UsbSerial.svg)](https://jitpack.io/#felHR85/UsbSerial) [![AndroidArsenal](https://img.shields.io/badge/Android%20Arsenal-UsbSerial-green.svg?style=true)](https://android-arsenal.com/details/1/4162) [![Join the chat at https://gitter.im/UsbSerial/Lobby](https://badges.gitter.im/UsbSerial/Lobby.svg)](https://gitter.im/UsbSerial/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
UsbSerial [![Build Status](https://travis-ci.org/felHR85/UsbSerial.svg?branch=master)](https://travis-ci.org/felHR85/UsbSerial) [![](https://jitpack.io/v/felHR85/UsbSerial.svg)](https://jitpack.io/#felHR85/UsbSerial) [![AndroidArsenal](https://img.shields.io/badge/Android%20Arsenal-UsbSerial-green.svg?style=true)](https://android-arsenal.com/details/1/4162) [![Join the chat at https://gitter.im/UsbSerial/Lobby](https://badges.gitter.im/UsbSerial/Lobby.svg)](https://gitter.im/UsbSerial/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
=========
Usb serial controller for Android. For more information, there is [a more complete description](http://felhr85.net/2014/11/11/usbserial-a-serial-port-driver-library-for-android-v2-0/).

Expand Down
16 changes: 16 additions & 0 deletions RELEASING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Releasing
========

1. Change the `VERSION_NAME` value in `gradle.properties` to the version number to be released.
2. Update the `README.md` with the new version.
3. `./gradlew clean build`
4. `git commit -am "Prepare for release X.Y.Z."` (where X.Y.Z is the new version)
5. `git tag -a X.Y.Z -m "Version X.Y.Z"` -m "Changelog message 1" - m "Changelog message 2" -m "Changelog message 3"
6. `git push && git push --tags`

*Note:* To get the changelog messages from the commit history, issue

```shell
git log "$(git tag | tail -n2 | head -n1)..$(git tag | tail -n1)" --oneline --invert-grep --grep="Merge pull request" --grep="Prepare for release" | cut -d' ' -f2- | sed -E -e 's/^/-m "/' | sed -E -e 's/$/"/'
```

2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.0
VERSION_NAME=4.5.1
VERSION_CODE=1
ANDROID_BUILD_MIN_SDK_VERSION=12
ANDROID_BUILD_TARGET_SDK_VERSION=27
Expand Down
11 changes: 7 additions & 4 deletions usbserial/build.gradle
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
apply plugin: 'com.android.library'

def artifact = "usbserial.jar"

android {

group = 'com.felhr.usbserial'
version = '1.0.0'
version = project.VERSION_NAME

compileSdkVersion Integer.parseInt(project.ANDROID_BUILD_SDK_VERSION)

Expand All @@ -16,19 +18,20 @@ android {
defaultConfig {
minSdkVersion Integer.parseInt(project.ANDROID_BUILD_MIN_SDK_VERSION)
targetSdkVersion Integer.parseInt(project.ANDROID_BUILD_TARGET_SDK_VERSION)
archivesBaseName = "${project.name}-${project.VERSION_NAME}"
}

//noinspection GroovyAssignabilityCheck
task deleteJar(type: org.gradle.api.tasks.Delete) {
delete 'eclipse_lib/usbserial.jar'
task deleteJar(type: Delete) {
delete "eclipse_lib/${artifact}"
}

//noinspection GroovyAssignabilityCheck
task createJar(type: org.gradle.api.tasks.Copy) {
from('build/intermediates/bundles/release/')
into('eclipse_lib/')
include('classes.jar')
rename('classes.jar', 'usbserial.jar')
rename('classes.jar', artifact)
}

createJar.dependsOn(deleteJar, build)
Expand Down
Binary file modified usbserial/eclipse_lib/usbserial.jar
Binary file not shown.

0 comments on commit 9d9c418

Please sign in to comment.