From bfa50147aba114a05f3e2a77595dfbf756af270e Mon Sep 17 00:00:00 2001 From: soloturn Date: Mon, 22 Feb 2021 02:41:39 +0100 Subject: [PATCH 1/3] gradle, set jar version to -- set the version to the last tag, plus the number of commits since the last tag (called "distance"), and the git hash (sha). an example: 1.7.94-9-c9d7deca in case there is an annotated tag on the commit built itself it is a release, and no distance, and sha is added: 1.7.94 in case the build is not from main and master branch, the branch name will be added, special characters are translated to underscore: 1.7.94-9-c9d7deca-other_branch --- build.gradle.kts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 5572205f..0cdfc10c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,4 +1,5 @@ plugins { + id("fr.brouillard.oss.gradle.jgitver") version "0.9.1" id("jacoco") id("java") id("maven-publish") @@ -29,9 +30,15 @@ group = "com.rarchives.ripme" version = "1.7.94" description = "ripme" -java { - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 +jgitver { + gitCommitIDLength = 8 + nonQualifierBranches = "main,master" + useGitCommitID = true +} + +java { + sourceCompatibility = JavaVersion.VERSION_1_8 + targetCompatibility = JavaVersion.VERSION_1_8 } tasks.withType { From c2a80db78bad475395519c591d904bf99cc08abf Mon Sep 17 00:00:00 2001 From: soloturn Date: Tue, 23 Feb 2021 19:24:32 +0100 Subject: [PATCH 2/3] maven github action now only manually triggered --- .github/workflows/maven.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index ea6ac25a..038c890f 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,6 +1,6 @@ name: Java CI -on: [push, pull_request] +on: workflow_dispatch jobs: build: From 1847965a452ddbcbb542c3a67422a1851f4a358c Mon Sep 17 00:00:00 2001 From: soloturn Date: Tue, 23 Feb 2021 19:19:02 +0100 Subject: [PATCH 3/3] build with gradle, cache build artefacts to speed it up --- .github/workflows/gradle.yml | 44 ++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/gradle.yml diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml new file mode 100644 index 00000000..38ad74fa --- /dev/null +++ b/.github/workflows/gradle.yml @@ -0,0 +1,44 @@ +name: CI + release + +on: [push, pull_request] + +jobs: + build: + + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macOS-latest] + java: [1.8] + include: # test newest java on one os only, upload from ubuntu java8 + - os: ubuntu-latest + java: 1.15 + - os: ubuntu-latest + upload: true + + steps: + - uses: actions/checkout@v1 + - name: Set up JDK + uses: actions/setup-java@v1 + with: + java-version: ${{ matrix.java }} + - name: Cache Gradle packages + # speed up the build by caching dependencies, downloaded versions + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Build with Gradle + run: ./gradlew build + - name: upload jar as asset + if: matrix.upload + uses: actions/upload-artifact@v2 + with: + name: zipped-ripme-jar + path: build/libs/*.jar + +# vim:set ts=2 sw=2 et: