[actions] those conditionals were not conditional enough... #612
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 dist | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
create_staging_repository: | |
runs-on: ubuntu-22.04 | |
name: Create staging repository | |
outputs: | |
repository_id: ${{ steps.create.outputs.repository_id }} | |
steps: | |
- id: create | |
name: create OSSRH Repository for aggregated pushes (ONLY FOR RELEASES) | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: nexus-actions/create-nexus-staging-repo@main | |
with: | |
username: atsushieno | |
password: ${{ secrets.OSSRH_PASSWORD }} | |
staging_profile_id: 1b92322eb8632e | |
description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }} | |
base_url: https://s01.oss.sonatype.org/service/local/ | |
build: | |
name: build on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, macos-13, macos-14] | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: setup apt packages on Linux | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
echo y | sudo apt-get install doxygen cmake ninja-build libasound2-dev libjack-jackd2-0 | |
- name: set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 17 | |
distribution: temurin | |
# Only for release tags | |
- name: setup gpg necessities | |
if: startsWith(github.ref, 'refs/tags/') | |
shell: bash | |
run: | | |
mkdir -p '${{ github.workspace }}' | |
echo '${{ secrets.GPG_KEY_CONTENTS }}' | base64 -d > '${{ github.workspace }}/${{ secrets.SIGNING_SECRET_KEY_RING_FILE }}' | |
- name: rewrite build.gradle to require signing on awkward OS | |
if: startsWith(github.ref, 'refs/tags/') && contains(matrix.os, 'macos') | |
run: | | |
sed -i "" "s/signing {}/signing { sign(publishing.publications) }/" */build.gradle* | |
- name: rewrite build.gradle to require signing on standard OS | |
shell: bash | |
if: startsWith(github.ref, 'refs/tags/') && !contains(matrix.os, 'macos') | |
run: | | |
sed -i "s/signing {}/signing { sign(publishing.publications) }/" */build.gradle* | |
- name: build RtMidi for Kotlin/Native | |
run: ./build-rtmidi.sh | |
# Workaround rtmidi-javacpp reference resolution failure issue | |
- name: build and publishToMavenLocal rtmidi-javacpp (just for local platform is fine) | |
run: cd external/rtmidi-javacpp && ./gradlew build publishToMavenLocal; cd ../.. | |
# only for NON-releases on macos-13 | |
- name: macos-13 lightweight build with Gradle for libs | |
if: ${{ !startsWith(github.ref, 'refs/tags/') && contains(matrix.os, 'macos-13') }} | |
run: ./gradlew --warning-mode all publishToMavenLocal | |
# only for releases on macos-13 | |
- name: macos-13 lightweight build with Gradle for libs | |
if: ${{ startsWith(github.ref, 'refs/tags/') && contains(matrix.os, 'macos-13') }} | |
run: ./gradlew --warning-mode all publish | |
env: | |
OSSRH_USERNAME: atsushieno | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
OSSRH_STAGING_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ format('{0}/{1}', github.workspace, secrets.SIGNING_SECRET_KEY_RING_FILE) }} | |
# only for NON-releases on macos-14 | |
- name: macos-14 lightweight build with Gradle for libs and apps | |
if: ${{ !startsWith(github.ref, 'refs/tags/') && contains(matrix.os, 'macos-14') }} | |
run: ./gradlew --warning-mode all publishToMavenLocal iosArm64Binaries | |
# only for releases on macos-14 | |
- name: macos-14 lightweight build with Gradle for libs and apps | |
if: ${{ startsWith(github.ref, 'refs/tags/') && contains(matrix.os, 'macos-14') }} | |
run: ./gradlew --warning-mode all publish iosArm64Binaries packageDmg | |
env: | |
OSSRH_USERNAME: atsushieno | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
OSSRH_STAGING_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ format('{0}/{1}', github.workspace, secrets.SIGNING_SECRET_KEY_RING_FILE) }} | |
# only for NON-releases on Linux | |
- name: linux build with Gradle | |
if: ${{ !startsWith(github.ref, 'refs/tags/') && contains(matrix.os, 'ubuntu-22.04') }} | |
run: ./gradlew --warning-mode all build | |
# only for releases on Linux | |
- name: linux publish with Gradle | |
if: ${{ startsWith(github.ref, 'refs/tags/') && contains(matrix.os, 'ubuntu-22.04') }} | |
run: ./gradlew --warning-mode all dokkaHtml publish | |
env: | |
OSSRH_USERNAME: atsushieno | |
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} | |
OSSRH_STAGING_REPOSITORY_ID: ${{ needs.create_staging_repository.outputs.repository_id }} | |
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} | |
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} | |
SIGNING_SECRET_KEY_RING_FILE: ${{ format('{0}/{1}', github.workspace, secrets.SIGNING_SECRET_KEY_RING_FILE) }} | |
- name: upload build failure logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-failure-logs-${{ matrix.os }} | |
path: | | |
ktmidi/build/reports/ | |
ktmidi-jvm-desktop/build/reports/ | |
ktmidi/*.log | |
ktmidi-ci/*.log | |
ktmidi-native-ext/*.log | |
ktmidi-jvm-desktop/*.log | |
- name: upload artifact | |
if: success() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ktmidi-artifacts-${{ matrix.os }} | |
path: | | |
ktmidi/build/libs/*.jar | |
ktmidi/build/outputs/aar/*.aar | |
ktmidi-ci/build/libs/*.jar | |
ktmidi-ci/build/outputs/aar/*.aar | |
ktmidi-native-ext/build/bin | |
ktmidi-jvm-desktop/build/libs/*.jar | |
ktmidi-ci-tool/build/bin/iosArm64 | |
ktmidi-ci-tool/build/compose/binaries/main/dmg | |
# only for releases | |
- name: deploy to GitHub Pages | |
if: ${{ startsWith(github.ref, 'refs/tags/') && startsWith(matrix.os, 'ubuntu') }} | |
uses: JamesIves/github-pages-deploy-action@4.1.2 | |
with: | |
branch: gh-pages | |
folder: ktmidi/build/dokka/html |