Build library package on release #28
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build library package on release | |
on: | |
release: | |
types: | |
- published | |
jobs: | |
build_library: | |
runs-on: ubuntu-latest | |
env: | |
RELEASE_NAME: ${{ github.ref_name}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Set up JDK | |
uses: actions/setup-java@v2 | |
with: | |
java-version: '11' | |
distribution: 'temurin' | |
- name: Grant execute permission for Gradlew | |
run: chmod +x gradlew | |
- name: check release name matches version pattern | |
run: | | |
PATTERN="^([0-9]+\.[0-9]+(\.[0-9]+)?)(-[A-Za-z]+(-[0-9]+))?$" | |
if [[ $RELEASE_NAME =~ $PATTERN ]]; then | |
echo "The RELEASE_NAME '$RELEASE_NAME' is valid." | |
else | |
echo "The RELEASE_NAME '$RELEASE_NAME' is invalid." | |
exit 1 | |
fi | |
- name: Build, run tests and publish | |
env: | |
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew -Pversion=$RELEASE_NAME publish |