Merge branch 'main' of git@github.com:burningwave/JSON.git into main #39
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 and test -> Release if requested | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- "src/main/**.java" | |
- "src/test/**.java" | |
- ".github/workflows/**" | |
- "**.properties" | |
- "**.xml" | |
jobs: | |
build-and-test-with-Java-8-and-later: | |
name: Build -> Test (JVM ${{ matrix.java }}, ${{ matrix.os }}) | |
strategy: | |
fail-fast: true | |
max-parallel: 15 | |
matrix: | |
architecture: [x64] | |
os: [windows-latest, macOS-latest, ubuntu-latest] | |
java: [8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21] | |
exclude: | |
- os: ubuntu-latest | |
java: 10 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'zulu' | |
architecture: ${{ matrix.architecture }} | |
- name: Build and test | |
run: mvn -B clean test -DskipTests=false --file pom.xml | |
release: | |
name: Release if requested | |
needs: [build-and-test-with-Java-8-and-later] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && endsWith(github.event.head_commit.message, 'Releasing new version') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 21 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 21 | |
distribution: 'zulu' | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
- name: Publish to the Maven Central repository | |
run: | | |
export GPG_TTY=$(tty) | |
echo "${{ secrets.gpg_private_key }}" | gpg --batch --import | |
git config user.name "${{ github.event.head_commit.committer.name }}" | |
git config user.email "${{ github.event.head_commit.committer.email }}" | |
mvn -B release:prepare release:perform -DskipTests=true -Dgpg.passphrase=${{ secrets.gpg_passphrase }} -Dgpg.keyname=${{ secrets.gpg_key_id }} -Drepository.url=https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git | |
env: | |
MAVEN_USERNAME: ${{ secrets.nexus_username }} | |
MAVEN_PASSWORD: ${{ secrets.nexus_password }} |