Skip to content

Commit

Permalink
(chore) publish on release
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Jun 19, 2024
1 parent 4e2e79f commit c7797d0
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 8 deletions.
84 changes: 84 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release

on:
release:
types:
- published

jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest ]
java-distribution:
- temurin
- zulu
- adopt-hotspot
- adopt-openj9
- liberica
- microsoft
- corretto
- semeru
- oracle
- dragonwell
fail-fast: false

runs-on: ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up "${{ matrix.java-distribution }}" JDK 21
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.java-distribution }}
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 (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install -y libpcre2-8-0

- name: Build with Gradle (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: ./gradlew build -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu

- name: Run tests (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: ./gradlew test -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu

publish:
runs-on: ubuntu-latest

permissions:
contents: read
packages: write

needs:
- build

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21

- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
run: ./gradlew publish -Ppcre4j.version=${{ github.event.release.tag_name }}
4 changes: 2 additions & 2 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ publishing {

mavenCentral {
credentials {
username = findProperty("pcre4j.mavenCentral.user") as String? ?: ""
password = findProperty("pcre4j.mavenCentral.password") as String? ?: ""
username = System.getenv("OSSRH_USERNAME")
username = System.getenv("OSSRH_TOKEN")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions ffm/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ publishing {

mavenCentral {
credentials {
username = findProperty("pcre4j.mavenCentral.user") as String? ?: ""
password = findProperty("pcre4j.mavenCentral.password") as String? ?: ""
username = System.getenv("OSSRH_USERNAME")
username = System.getenv("OSSRH_TOKEN")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions jna/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ publishing {

mavenCentral {
credentials {
username = findProperty("pcre4j.mavenCentral.user") as String? ?: ""
password = findProperty("pcre4j.mavenCentral.password") as String? ?: ""
username = System.getenv("OSSRH_USERNAME")
username = System.getenv("OSSRH_TOKEN")
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ publishing {

mavenCentral {
credentials {
username = findProperty("pcre4j.mavenCentral.user") as String? ?: ""
password = findProperty("pcre4j.mavenCentral.password") as String? ?: ""
username = System.getenv("OSSRH_USERNAME")
username = System.getenv("OSSRH_TOKEN")
}
}
}
Expand Down

0 comments on commit c7797d0

Please sign in to comment.