Skip to content

Commit

Permalink
feat(build): use semantic-release for automatic release publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
skylot committed Aug 26, 2018
1 parent 7492889 commit 156e420
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 57 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ build/
classes/
idea/
.gradle/
node_modules/

jadx-output/
*-tmp/
Expand Down
16 changes: 16 additions & 0 deletions .releaserc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
branch: release
verifyConditions:
- '@semantic-release/github'
prepare:
- path: '@semantic-release/exec'
cmd: "JADX_VERSION=${nextRelease.version} ./gradlew clean dist"
publish:
- path: '@semantic-release/exec'
cmd: "JADX_VERSION=${nextRelease.version} BINTRAY_PACKAGE=releases bash scripts/bintray-upload.sh"
- path: '@semantic-release/github'
assets:
- path: 'build/*.zip'
label: 'zip bundle'
- path: 'build/*.exe'
label: 'jadx-gui windows'

43 changes: 22 additions & 21 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,20 @@ language: java
sudo: false
dist: trusty

# don't build on tag push
if: tag IS blank

git:
depth: false

before_install:
- wget https://github.com/sormuras/bach/raw/master/install-jdk.sh
- chmod +x gradlew

env:
global:
- TERM=dumb
- JADX_VERSION="$(git describe --abbrev=0 --tags)-b$TRAVIS_BUILD_NUMBER-$(git rev-parse --short HEAD)"

matrix:
include:
Expand All @@ -19,30 +26,24 @@ matrix:

script:
- java -version
- sed -i " 1 s/.*/&-b$TRAVIS_BUILD_NUMBER-$(git rev-parse --short HEAD)/" version
- cat version
- sed -i "s/BUILD_VERSION/$(head -c -1 version)/g" bintray.json
- ./gradlew clean build

after_success:
- test $JDK = "oracle-8" && ./gradlew clean build jacocoTestReport && bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"
- test $JDK = "oracle-8" && ./gradlew clean sonarqube -Dsonar.host.url=$SONAR_HOST -Dsonar.organization=$SONAR_ORG -Dsonar.login=$SONAR_TOKEN || echo "Skip sonar build and upload"

before_deploy:
- ./gradlew clean dist

deploy:
provider: bintray
edge:
branch: v1.8.47
file: bintray.json
user: skylot
key: $BINTRAY_KEY
skip_cleanup: true
on:
branch: master
tags: false
condition: $JDK = oracle-8
- provider: script
skip_cleanup: true
on:
branch: master
tags: false
condition: $JDK = oracle-8
script: bash scripts/travis-master.sh

- provider: script
skip_cleanup: true
on:
branch: release
tags: false
condition: $JDK = oracle-8
script: bash scripts/travis-release.sh

notifications:
email:
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
[![Code Coverage](https://codecov.io/gh/skylot/jadx/branch/master/graph/badge.svg)](https://codecov.io/gh/skylot/jadx)
[![SonarQube Bugs](https://sonarcloud.io/api/project_badges/measure?project=jadx&metric=bugs)](https://sonarcloud.io/dashboard?id=jadx)
[![License](http://img.shields.io/:license-apache-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0.html)
[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)

**jadx** - Dex to Java decompiler

Expand Down
34 changes: 0 additions & 34 deletions bintray.json

This file was deleted.

3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ plugins {
id 'com.github.ben-manes.versions' version '0.20.0'
}

ext.jadxVersion = file('version').readLines().get(0)
ext.jadxVersion = System.getenv('JADX_VERSION') ?: "dev"
version = jadxVersion
println("jadx version: ${jadxVersion}")

allprojects {
apply plugin: 'java'
Expand Down
14 changes: 14 additions & 0 deletions scripts/bintray-upload.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -xe

export JFROG_CLI_OFFER_CONFIG=false
export JFROG_CLI_LOG_LEVEL=DEBUG

npm install -g jfrog-cli-go

TARGET=skylot/jadx/${BINTRAY_PACKAGE}/v${JADX_VERSION}
CREDENTIALS="--user=skylot --key=${BINTRAY_KEY}"

jfrog bt version-create ${TARGET} ${CREDENTIALS} --desc=${JADX_VERSION}
jfrog bt upload 'build/jadx.*\.(zip|exe)' ${TARGET} ${CREDENTIALS} --regexp=true --publish=true
jfrog bt version-publish ${TARGET} ${CREDENTIALS}
13 changes: 13 additions & 0 deletions scripts/travis-master.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env bash
set -xe

# upload coverage to codecov
./gradlew clean build jacocoTestReport
bash <(curl -s https://codecov.io/bash) || echo "Codecov did not collect coverage reports"

# run sonar checks
./gradlew clean sonarqube -Dsonar.host.url=${SONAR_HOST} -Dsonar.organization=${SONAR_ORG} -Dsonar.login=${SONAR_TOKEN} || echo "Skip sonar build and upload"

# upload bundles to bintray unstable package
./gradlew clean dist
BINTRAY_PACKAGE=unstable bash scripts/bintray-upload.sh
6 changes: 6 additions & 0 deletions scripts/travis-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -xe

npm install -g semantic-release
npm install -g semantic-release/exec
semantic-release
1 change: 0 additions & 1 deletion version

This file was deleted.

0 comments on commit 156e420

Please sign in to comment.