Bump actions/setup-java from 3 to 4 #183
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
# | |
# CI build that assembles artifacts and runs tests. | |
# If validation is successful this workflow releases from the main dev branch. | |
# | |
# - skipping CI: add [skip ci] to the commit message | |
# - skipping release: add [skip release] to the commit message | |
# | |
name: CI | |
on: | |
push: | |
branches: | |
- master | |
tags-ignore: | |
- v* # release tags are automatically generated after a successful CI build, no need to run CI against them | |
pull_request: | |
branches: | |
- master | |
jobs: | |
# | |
# SINGLE-JOB | |
# | |
verify: | |
runs-on: ubuntu-latest | |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" | |
steps: | |
- name: 1. Check out code | |
uses: actions/checkout@v3 # https://github.com/actions/checkout | |
- name: 2. Set up Java 11 | |
uses: actions/setup-java@v4 # https://github.com/actions/setup-java | |
with: | |
java-version: 11 | |
distribution: 'zulu' | |
- name: 3. Validate Gradle wrapper | |
uses: gradle/[email protected] # https://github.com/gradle/wrapper-validation-action | |
- name: 4. Build and check reproducibility of artifacts | |
run: ./check_reproducibility.sh | |
# | |
# Main build job | |
# | |
build: | |
needs: [verify] | |
runs-on: ${{ matrix.os }} | |
# Definition of the build matrix | |
strategy: | |
matrix: | |
java: [11, 17] | |
os: [ ubuntu-latest, windows-latest, macOS-latest ] | |
steps: | |
- name: 1. Check out code | |
uses: actions/checkout@v3 # https://github.com/actions/checkout | |
- name: 2. Set up Java ${{ matrix.java }} | |
uses: actions/setup-java@v4 # https://github.com/actions/setup-java | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: 3. Build on ${{ matrix.os }} with Java ${{ matrix.java }} | |
run: ./gradlew build idea | |
# | |
# Release job, only for pushes to the main development branch | |
# | |
release: | |
concurrency: release | |
runs-on: ubuntu-latest | |
needs: [build] # build job must pass before we can release | |
if: github.event_name == 'push' | |
&& github.ref == 'refs/heads/master' | |
&& github.repository == 'mockito/mockito-testng' | |
&& !contains(toJSON(github.event.commits.*.message), '[skip release]') | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v3 # https://github.com/actions/checkout | |
with: | |
fetch-depth: '0' # https://github.com/shipkit/shipkit-changelog#fetch-depth-on-ci | |
- name: Set up Java 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'zulu' | |
- name: Build and publish to Sonatype/MavenCentral | |
run: ./gradlew publishToSonatype closeAndReleaseStagingRepository githubRelease | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
NEXUS_TOKEN_USER: ${{secrets.NEXUS_TOKEN_USER}} | |
NEXUS_TOKEN_PWD: ${{secrets.NEXUS_TOKEN_PWD}} | |
PGP_KEY: ${{secrets.PGP_KEY}} | |
PGP_PWD: ${{secrets.PGP_PWD}} |