Skip to content

Commit

Permalink
Merge #143
Browse files Browse the repository at this point in the history
143: Add check release script r=eskombro a=curquiza

Closes #140 

I tested it this way to "immitate" the GitHub action behavior:

<img width="581" alt="Capture d’écran 2021-03-20 à 19 36 50" src="https://user-images.githubusercontent.com/20380692/111882044-a37d9600-89b3-11eb-804e-14e19f725fea.png">


Co-authored-by: Clémentine Urquizar <[email protected]>
  • Loading branch information
bors[bot] and curquiza authored Mar 22, 2021
2 parents b7af072 + e079987 commit 7ed825f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/scripts/check-release.sh
Original file line number Diff line number Diff line change
@@ -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 '<version>' $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
2 changes: 2 additions & 0 deletions .github/workflows/ossrh-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7ed825f

Please sign in to comment.