(chore) publish snapshots to OSSRH #10
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
compatibility: | |
strategy: | |
matrix: | |
os: [ ubuntu-latest ] | |
java-distribution: | |
- temurin | |
- zulu | |
- adopt-hotspot | |
- adopt-openj9 | |
- liberica | |
- microsoft | |
- corretto | |
- semeru | |
- oracle | |
- dragonwell | |
java-version: [ 21 ] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up ${{ matrix.java-distribution }}-jdk-${{ matrix.java-version }} | |
uses: actions/setup-java@v4 | |
with: | |
distribution: ${{ matrix.java-distribution }} | |
java-version: ${{ matrix.java-version }} | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: gradle-${{ runner.os }} | |
- name: Install PCRE | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: sudo apt-get install -y libpcre2-8-0 | |
- name: Test | |
if: ${{ matrix.os == 'ubuntu-latest' }} | |
run: ./gradlew ffm:test jna:test -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu | |
package: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
needs: | |
- compatibility | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up temurin-jdk-21 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 21 | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: gradle-${{ runner.os }} | |
- name: Install PCRE | |
run: sudo apt-get install -y libpcre2-8-0 | |
- name: Build | |
run: ./gradlew build jacocoAggregatedTestReport -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu | |
- name: Codecov | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: build/reports/jacoco/jacocoAggregatedTestReport/jacoco.xml | |
- name: Publish | |
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
env: | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: ./gradlew publish -Ppcre4j.version=${{ github.ref_name }}-SNAPSHOT |