github-action: bump gradle/wrapper-validation-action from 2.1.1 to 2.1.2 #65
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: Java7 | |
on: | |
push: | |
branches: [ main ] | |
paths: | |
- '.github/workflows/java7.yml' | |
- 'java7/**' | |
- 'test-resources/**' | |
tags-ignore: | |
- '**' | |
pull_request: | |
branches: [ main ] | |
paths: | |
- '.github/workflows/java7.yml' | |
- 'java7/**' | |
- 'test-resources/**' | |
jobs: | |
build-and-test: | |
name: Build and Test | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-latest ] | |
java: [ 8 ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v4 | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'adopt' | |
cache: gradle | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v2.1.2 | |
- name: Test | |
run: cd java7 && ./gradlew test | |
set-release-version: | |
name: Prepare version to tag and release | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Checkout current branch | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 #we need to make a git diff of the last 2 commits | |
- name: Get project version | |
id: get_project_version | |
run: | | |
cd java7 && PROJECT_VERSION=$(./gradlew properties | grep "version:" | awk '{print $2}') | |
echo "::set-output name=project_version::$PROJECT_VERSION" | |
- name: Get changed version from last two commits | |
id: get_changed_version | |
run: | | |
CHANGED_VERSION=$(git diff HEAD^ -- ./java7/gradle.properties | grep +version= | awk -F "=" '{print $2}') | |
echo "::set-output name=changed_version::$CHANGED_VERSION" | |
- name: Print changed version from last two commits | |
run: echo ${{ steps.get_changed_version.outputs.changed_version }} | |
outputs: | |
project_version: ${{ steps.get_project_version.outputs.project_version }} | |
changed_version: ${{ steps.get_changed_version.outputs.changed_version }} | |
publish: | |
name: Publish to Sonatype and Maven Central | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && needs.set-release-version.outputs.changed_version != '' | |
needs: [build-and-test, set-release-version] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup JDK 8 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '8' | |
distribution: 'adopt' | |
cache: gradle | |
- name: Validate gradle wrapper | |
uses: gradle/wrapper-validation-action@v2.1.2 | |
- name: Publish to Sonatype and Maven Central | |
run: cd java7 && ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
SONATYPE_GPG_KEY: ${{ secrets.SONATYPE_GPG_KEY }} | |
SONATYPE_GPG_PASSPHRASE: ${{ secrets.SONATYPE_GPG_PASSPHRASE }} | |
create_github_release: | |
name: Create Github Release | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' && !contains(needs.set-release-version.outputs.project_version, 'SNAPSHOT') | |
needs: [publish] | |
steps: | |
- name: Create tag | |
id: create_tag | |
uses: mathieudutour/github-tag-action@v6.2 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
custom_tag: ${{ needs.set-release-version.outputs.project_version }} | |
tag_prefix: 'java7-v' | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: ${{ steps.create_tag.outputs.new_tag }} | |
generate_release_notes: false |