0.2-NGE #32
Workflow file for this run
This file contains hidden or 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: Java CI with Gradle | |
| on: | |
| push: | |
| branches: [ main ] | |
| tags: [ '*' ] | |
| pull_request: | |
| branches: [ main ] | |
| release: | |
| types: [ published ] | |
| workflow_dispatch: | |
| jobs: | |
| build-macos: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Install dependencies | |
| run: | | |
| brew update | |
| brew install cmake ninja pkg-config openssl conan | |
| conan --version | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Build macOS Native Libraries | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION="-Pversion=${GITHUB_REF#refs/tags/}" | |
| fi | |
| ./gradlew packageNativeForDarwinArm64 packageNativeForDarwinX8664 --no-daemon --no-parallel $VERSION | |
| - name: Upload macOS artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: macos-prebuilt | |
| path: build/libs/libdatachannel-java-*-darwin-*.jar | |
| retention-days: 1 | |
| build-publish: | |
| runs-on: ubuntu-latest | |
| needs: build-macos | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set up JDK | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '11' | |
| distribution: 'temurin' | |
| cache: gradle | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@v4 | |
| - name: Download macOS prebuilt libraries | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: macos-prebuilt | |
| path: prebuilt | |
| - name: List prebuilt libraries | |
| run: | | |
| mkdir -p prebuilt | |
| ls -la prebuilt | |
| - name: Build and Publish | |
| if: github.event_name != 'push' && github.event_name != 'release' | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION="-Pversion=${GITHUB_REF#refs/tags/}" | |
| fi | |
| ./gradlew --no-configuration-cache --no-parallel assemble | |
| - name: Publish to Repository | |
| if: github.event_name == 'push' || github.event_name == 'release' | |
| run: | | |
| export VERSION="" | |
| if [[ "${GITHUB_REF}" == refs/tags/* ]]; then | |
| export VERSION="-Pversion=${GITHUB_REF#refs/tags/}" | |
| fi | |
| ./gradlew --no-configuration-cache --no-daemon --no-parallel $VERSION -Pgpr.user=${{ github.actor }} -Pgpr.key=${{ secrets.GITHUB_TOKEN }} -Pgpr.owner=${{ github.repository_owner }} publish | |
| - name: Upload distribution artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: dist | |
| path: dist | |
| retention-days: 7 |