From 1d9a49d5529129f81d021e363320029ca5d025a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Pich?= Date: Tue, 4 Jun 2019 01:53:20 +0200 Subject: [PATCH] Add githook plugin (#398) --- app/build.gradle | 1 + app/hooks.gradle | 10 ++++++++++ app/play-publish-lint.sh | 7 +++++++ app/src/main/play/release-notes/pl-PL/default.txt | 2 +- build.gradle | 1 + 5 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 app/hooks.gradle create mode 100755 app/play-publish-lint.sh diff --git a/app/build.gradle b/app/build.gradle index c8ea5a252..8a6b25ea4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,6 +6,7 @@ apply plugin: 'io.fabric' apply plugin: 'com.github.triplet.play' apply from: 'jacoco.gradle' apply from: 'sonarqube.gradle' +apply from: 'hooks.gradle' android { compileSdkVersion 28 diff --git a/app/hooks.gradle b/app/hooks.gradle new file mode 100644 index 000000000..038fa9fb2 --- /dev/null +++ b/app/hooks.gradle @@ -0,0 +1,10 @@ +apply plugin: "com.star-zero.gradle.githook" + +githook { + failOnMissingHooksDir = false + hooks { + "pre-push" { + shell = "./app/play-publish-lint.sh" + } + } +} diff --git a/app/play-publish-lint.sh b/app/play-publish-lint.sh new file mode 100755 index 000000000..d3354b1ad --- /dev/null +++ b/app/play-publish-lint.sh @@ -0,0 +1,7 @@ +#!/bin/bash - + +content=$(cat < "app/src/main/play/release-notes/pl-PL/default.txt") || exit +if [[ "${#content}" -gt 500 ]]; then + echo >&2 "Release notes content has reached the limit of 500 characters" + exit 1 +fi diff --git a/app/src/main/play/release-notes/pl-PL/default.txt b/app/src/main/play/release-notes/pl-PL/default.txt index 7fe143d8e..e2048e1f9 100644 --- a/app/src/main/play/release-notes/pl-PL/default.txt +++ b/app/src/main/play/release-notes/pl-PL/default.txt @@ -2,7 +2,7 @@ Wersja 0.9.0 Dodaliśmy: - zarządzanie dostępem mobilnym do dziennika -- wyświetlanie sumy punktów (jeśli dziennik obsługuje) +- wyświetlanie sumy punktów - wyświetlanie informacji o wygasłej sesji, gdy zostanie zmienione hasło Naprawiliśmy: diff --git a/build.gradle b/build.gradle index 4ed9ec686..ac8a0926d 100644 --- a/build.gradle +++ b/build.gradle @@ -14,6 +14,7 @@ buildscript { classpath "io.fabric.tools:gradle:1.29.0" classpath "com.github.triplet.gradle:play-publisher:2.2.1" classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.7.1" + classpath "gradle.plugin.com.star-zero.gradle:githook:1.1.0" } }