Release Publisher #79
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: Release Publisher | |
on: | |
push: | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
- "[0-9]+.[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build: | |
name: Release JDK ${{ matrix.java }} | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
java: [ 8, 11 ] | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Check NO SNAPSHOT version suffix | |
run: if [[ $(cat gradle.properties | grep version= | sed 's/^version=//') =~ .*-SNAPSHOT ]]; then exit 1; else exit 0; fi | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
cache: 'gradle' | |
- name: Print JDK Version | |
run: java -version | |
- name: Make gradlew Executable | |
run: chmod +x gradlew | |
- name: Build with Gradle | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }} | |
SONATYPE_USER: ${{ secrets.SONATYPE_USER }} | |
SONATYPE_TOKEN: ${{ secrets.SONATYPE_TOKEN }} | |
run: | | |
# Build arguments to feed to the single gradlew publish command | |
if [ "${{ matrix.java }}" = "8" ]; then | |
FIRST_GRADLE_TARGETS=" clean check" | |
SECOND_GRADLE_TARGETS=" --no-parallel publish" | |
else | |
FIRST_GRADLE_TARGETS="" | |
SECOND_GRADLE_TARGETS="" | |
# Execute the printJavaTargetCompatibility task to get the java target compatibility for each subproject | |
# and extract the projects that require jdk9+. | |
while read -r line | |
do | |
javaTarget=$(echo "$line" | sed -e 's/^version: \(.*\) name:.*/\1/g') | |
if [ "$javaTarget" = "1.9" ] || [ "$javaTarget" = "1.10" ] || [ "$javaTarget" -gt "8" ] 2> /dev/null | |
then | |
currDir=$(echo "$line" | sed -e 's/^version:.* name: \(.*\)$/\1/g') | |
FIRST_GRADLE_TARGETS="$FIRST_GRADLE_TARGETS :$currDir:clean :$currDir:check" | |
SECOND_GRADLE_TARGETS="$SECOND_GRADLE_TARGETS :$currDir:publish" | |
fi | |
done < <(./gradlew printJavaTargetCompatibility) | |
fi | |
# Execute the gradlew command to publish the build | |
sudo -E env "PATH=$PATH" bash -c "ulimit -l 65536 && ulimit -a && ./gradlew --no-daemon --parallel -PreleaseBuild=true$FIRST_GRADLE_TARGETS && ./gradlew --no-daemon -PreleaseBuild=true$SECOND_GRADLE_TARGETS" | |
- name: Publish Test Results | |
if: always() | |
uses: scacap/action-surefire-report@6efd3d10b5c1996a0724dd4c4915a073f685fefa | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
report_paths: '**/build/test-results/test/TEST-*.xml' | |
check_name: Test Report JDK ${{ matrix.java }} | |
- name: Publish Checkstyle Report | |
if: always() | |
uses: jwgmeligmeyling/checkstyle-github-action@50292990e18466f2c5d95d04ff5fab931254fa5f | |
with: | |
name: Checkstyle Report JDK ${{ matrix.java }} | |
path: '**/build/reports/checkstyle/*.xml' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish PMD Report | |
if: always() | |
uses: jwgmeligmeyling/pmd-github-action@322e346bd76a0757c4d54ff9209e245965aa066d | |
with: | |
name: PMD Report JDK ${{ matrix.java }} | |
path: '**/build/reports/pmd/*.xml' | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish SpotBugs Report | |
if: always() | |
# v1.2 | |
uses: jwgmeligmeyling/spotbugs-github-action@b8e2c3523acb34c87f14e18cbcd2d87db8c8584e | |
with: | |
name: SpotBugs Report JDK ${{ matrix.java }} | |
path: '**/build/reports/spotbugs/*.xml' | |
token: ${{ secrets.GITHUB_TOKEN }} |