Skip to content

Merge pull request #37 from openfga/headers-options-configs #250

Merge pull request #37 from openfga/headers-options-configs

Merge pull request #37 from openfga/headers-options-configs #250

Workflow file for this run

name: Java CI with Gradle
on:
merge_group:
push:
pull_request:
workflow_dispatch:
jobs:
test:
name: Test and Build OpenFGA
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '11', '17', '20' ]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.5.2
- name: Set up JDK
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: gradle
# By Gradle conventions, "build" requires "check" to pass. "check" is an umbrella task that
# runs tests and lints. See the project's build.gradle for configurations.
- name: Test and Build with Gradle
run: |
./gradlew build
publish-maven-central:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: startsWith(github.ref, 'refs/tags/v')
needs: [test]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.5.2
- name: Set up JDK
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
java-version: 11
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0
- name: Publish package
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
with:
# Tasks created by https://github.com/gradle-nexus/publish-plugin
arguments: publishToSonatype closeAndReleaseSonatypeStagingRepository
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
ORG_GRADLE_PROJECT_SIGNINGKEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
publish-github-packages:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
if: startsWith(github.ref, 'refs/tags/v')
needs: [test]
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.5.2
- name: Set up JDK
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
with:
java-version: 11
distribution: 'temurin'
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@56b90f209b02bf6d1deae490e9ef18b21a389cd4 # v1.1.0
- name: Publish package
uses: gradle/gradle-build-action@87a9a15658c426a54dd469d4fc7dc1a73ca9d4a6 # v2.10.0
with:
# Tasks created by https://docs.gradle.org/current/userguide/publishing_maven.html
arguments: publishAllPublicationsToGitHubPackagesRepository
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_GRADLE_PROJECT_SIGNINGKEY: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
ORG_GRADLE_PROJECT_SIGNINGPASSWORD: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
create-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
needs: [publish-maven-central, publish-github-packages]
steps:
- uses: actions/checkout@v4
- uses: Roang-zero1/github-create-release-action@57eb9bdce7a964e48788b9e78b5ac766cb684803
with:
version_regex: ^v[[:digit:]]+\.[[:digit:]]+\.[[:digit:]]+
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}