Skip to content

GitHub Actions: attempt to create gh-pages. #45

GitHub Actions: attempt to create gh-pages.

GitHub Actions: attempt to create gh-pages. #45

Workflow file for this run

name: 'build'
on:
push:
pull_request:
workflow_dispatch:
jobs:
build_native:
name: 'build native library on ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-24.04-arm, macos-13, macos-14, windows-latest]
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: apt update (on Linux)
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
echo y | sudo apt-get install doxygen cmake ninja-build libasound2-dev libjack-jackd2-dev
- name: setup Windows developer tools for C++
if: startsWith(matrix.os, 'windows')
uses: ilammy/msvc-dev-cmd@v1
- name: build libremidi on non-Windows platforms
shell: bash
if: ${{ !startsWith(matrix.os, 'windows') }}
run: |
cd external/libremidi
cmake -B cmake-build-relwithdebinfo -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=On
cmake --build cmake-build-relwithdebinfo
- name: build libremidi on Windows
shell: bash
if: startsWith(matrix.os, 'windows')
run: |
cd external/libremidi
cmake -B cmake-build-relwithdebinfo -DBUILD_SHARED_LIBS=On
cmake --build cmake-build-relwithdebinfo --config=Release
- name: upload libremidi on ${{matrix.os}}
if: startsWith(matrix.os, 'macos')
uses: actions/upload-artifact@v4
with:
name: libremidi-bin-${{matrix.os}}
path: external/libremidi/cmake-build-relwithdebinfo/liblibremidi.dylib
- name: upload libremidi on ${{matrix.os}}
if: startsWith(matrix.os, 'ubuntu')
uses: actions/upload-artifact@v4
with:
name: libremidi-bin-${{matrix.os}}
path: external/libremidi/cmake-build-relwithdebinfo/liblibremidi.so
- name: upload libremidi on ${{matrix.os}}
if: startsWith(matrix.os, 'windows')
uses: actions/upload-artifact@v4
with:
name: libremidi-bin-${{matrix.os}}
path: external/libremidi/cmake-build-relwithdebinfo/Release/libremidi.dll
build-publish-jar:
name: 'build and publish jar'
needs: build_native
runs-on: ubuntu-24.04
steps:
# Do I need to check out the repo TWICE!?
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
# get native build outcomes from all the target lanes
- name: download libremidi on Darwin-x64
uses: actions/download-artifact@v4
with:
name: libremidi-bin-macos-13
path: libremidi-panama/src/main/resources/jne/macos/x64/
- name: download libremidi on Darwin-arm64
uses: actions/download-artifact@v4
with:
name: libremidi-bin-macos-14
path: libremidi-panama/src/main/resources/jne/macos/arm64/
- name: download libremidi on Linux-x64
uses: actions/download-artifact@v4
with:
name: libremidi-bin-ubuntu-24.04
path: libremidi-panama/src/main/resources/jne/linux/x64/
- name: download libremidi on Linux-arm64
uses: actions/download-artifact@v4
with:
name: libremidi-bin-ubuntu-24.04-arm
path: libremidi-panama/src/main/resources/jne/linux/arm64/
- name: download libremidi on Windows-x64
uses: actions/download-artifact@v4
with:
name: libremidi-bin-windows-latest
path: libremidi-panama/src/main/resources/jne/windows/x64/
- name: set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '22'
# 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
shell: bash
if: startsWith(github.ref, 'refs/tags/')
run: sed -i "s/signing {}/signing { sign(publishing.publications) }/" libremidi-panama/build.gradle
# build or publish, depending on whether it is for release tags or not
- name: build (ONLY FOR NON-RELEASES)
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
cd ${{ github.workspace }} && ./gradlew --warning-mode all build
- name: publish (ONLY FOR NEW RELEASE TAGS)
if: startsWith(github.ref, 'refs/tags/')
run: |
cd ${{ github.workspace }} && ./gradlew --warning-mode all build publish
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
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 artifact - Jar
if: success()
uses: actions/upload-artifact@v4
with:
name: libremidi-panama-jars
path: libremidi-panama/build/libs/*.jar
# Update API reference (release only)
- name: deploy to GitHub Pages
if: success() && startsWith(github.ref, 'refs/tags/')
uses: JamesIves/github-pages-deploy-action@v4
with:
branch: gh-pages
folder: libremidi-panama/build/docs/javadoc