From 9ffdd8731dbf56e61f1e2d961de8d029c07f83ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar?= Date: Sat, 20 Mar 2021 19:34:59 +0100 Subject: [PATCH 1/2] Add check release script --- .github/scripts/check-release.sh | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 .github/scripts/check-release.sh diff --git a/.github/scripts/check-release.sh b/.github/scripts/check-release.sh new file mode 100644 index 00000000..c1145fb7 --- /dev/null +++ b/.github/scripts/check-release.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +# Checking if current tag matches the package version +current_tag=$(echo $GITHUB_REF | tr -d 'refs/tags/v') +check1='build.gradle' +check2='README.md' +check3='README.md' + +tag1=$(grep '^version = ' $check1 | cut -d "'" -f 2 | tr -d ' ') +tag2=$(grep '' $check2 | cut -d '>' -f2 | cut -d '<' -f1) +tag3=$(grep 'implementation' $check3 | cut -d : -f3 | tr -d "'") +if [ "$current_tag" != "$tag1" ] || [ "$current_tag" != "$tag2" ] || [ "$current_tag" != "$tag3" ]; then + echo "Error: the current tag does not match the version in package check(s)." + echo "$check1: found $tag1 - expected $current_tag" + echo "$check2: found $tag2 - expected $current_tag" + echo "$check3: found $tag3 - expected $current_tag" + exit 1 +fi + +echo 'OK' +exit 0 From e07998756fae895c4ee0a901637409282a117fa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9mentine=20Urquizar?= Date: Mon, 22 Mar 2021 18:49:36 +0100 Subject: [PATCH 2/2] Add check in CI --- .github/workflows/ossrh-publish.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/ossrh-publish.yml b/.github/workflows/ossrh-publish.yml index a24cca71..ae8fc4b5 100644 --- a/.github/workflows/ossrh-publish.yml +++ b/.github/workflows/ossrh-publish.yml @@ -14,6 +14,8 @@ jobs: uses: actions/setup-java@v1 with: java-version: 1.8 + - name: Check release validity + run: bash .github/scripts/check-release.sh - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle