diff --git a/.github/workflows/ffi-builds.yml b/.github/workflows/ffi-builds.yml index c44998dbe..606132518 100644 --- a/.github/workflows/ffi-builds.yml +++ b/.github/workflows/ffi-builds.yml @@ -16,6 +16,8 @@ name: FFI on: push: branches: ["main"] + tags: + - "ffi-v*" workflow_dispatch: env: @@ -68,12 +70,12 @@ jobs: dylib: liblivekit_ffi.so target: x86_64-unknown-linux-gnu name: ffi-linux-x86_64 - - os: buildjet-4vcpu-ubuntu-2204-arm - platform: linux - build_image: quay.io/pypa/manylinux_2_28_aarch64 - dylib: liblivekit_ffi.so - target: aarch64-unknown-linux-gnu - name: ffi-linux-arm64 + # - os: buildjet-4vcpu-ubuntu-2204-arm + # platform: linux + # build_image: quay.io/pypa/manylinux_2_28_aarch64 + # dylib: liblivekit_ffi.so + # target: aarch64-unknown-linux-gnu + # name: ffi-linux-arm64 - os: ubuntu-latest platform: android dylib: liblivekit_ffi.so @@ -130,6 +132,8 @@ jobs: curl --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y; \ cd livekit-ffi && cargo build --release --target ${{ matrix.target }} ${{ matrix.buildargs }}" + sudo chown -R $USER:$USER target/${{ matrix.target }}/release/ + # on android use cargo ndk - name: Build (Android) if: ${{ matrix.platform == 'android' }} @@ -138,24 +142,57 @@ jobs: cargo install cargo-ndk cargo ndk --target ${{ matrix.target }} build --release ${{ matrix.buildargs }} + - name: Copy/Build licenses + run: | + echo "# livekit" > TEMP_LICENSE.md + echo "```" >> TEMP_LICENSE.md + cat LICENSE >> TEMP_LICENSE.md + echo "```" >> TEMP_LICENSE.md + cat livekit-ffi/WEBRTC_LICENSE.md >> TEMP_LICENSE.md + mv TEMP_LICENSE.md target/${{ matrix.target }}/release/LICENSE.md + shell: bash + # zip the files - name: Zip artifact (Unix) if: ${{ matrix.os != 'windows-latest' }} - # using sudo because the above container (manylinux) runs as root run: | - sudo cp livekit-ffi/include/livekit_ffi.h target/${{ matrix.target }}/release/ + cp livekit-ffi/include/livekit_ffi.h target/${{ matrix.target }}/release/ cd target/${{ matrix.target }}/release/ - zip ${{ github.workspace }}/${{ matrix.name }}.zip ${{ matrix.dylib }} livekit_ffi.h + zip ${{ github.workspace }}/${{ matrix.name }}.zip ${{ matrix.dylib }} livekit_ffi.h LICENSE.md - name: Zip artifact (Windows) if: ${{ matrix.os == 'windows-latest' }} run: | cp livekit-ffi/include/livekit_ffi.h target/${{ matrix.target }}/release/ cd target/${{ matrix.target }}/release/ - Get-ChildItem -Path ${{ matrix.dylib }}, livekit_ffi.h | Compress-Archive -DestinationPath ${{ github.workspace }}\${{ matrix.name }}.zip + Get-ChildItem -Path ${{ matrix.dylib }}, livekit_ffi.h, LICENSE.md | Compress-Archive -DestinationPath ${{ github.workspace }}\${{ matrix.name }}.zip - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: ${{ matrix.name }}.zip + name: ffi-builds path: ${{ matrix.name }}.zip + + + release: + name: Release to GH (Draft) + runs-on: ubuntu-latest + needs: build + permissions: + contents: write + if: startsWith(github.ref, 'refs/tags/ffi-v') + env: + GH_TOKEN: ${{ github.token }} + steps: + - uses: actions/checkout@v3 + + - name: Download artifacts + uses: actions/download-artifact@v3 + with: + name: ffi-builds + path: ${{ github.workspace }}/ffi-builds + + - name: Create draft release + run: | + gh release create ${{ github.ref_name }} --draft --title "${{ github.ref_name }}" + gh release upload ${{ github.ref_name }} ${{ github.workspace }}/ffi-builds/* \ No newline at end of file diff --git a/.github/workflows/webrtc-builds.yml b/.github/workflows/webrtc-builds.yml index 5d018dd1f..dc3fcc953 100644 --- a/.github/workflows/webrtc-builds.yml +++ b/.github/workflows/webrtc-builds.yml @@ -13,7 +13,11 @@ # limitations under the License. name: WebRTC builds -on: workflow_dispatch +on: + push: + tags: + - "webrtc-*" + workflow_dispatch: jobs: build: @@ -148,5 +152,5 @@ jobs: - name: Upload artifacts uses: actions/upload-artifact@v3 with: - name: ${{ steps.setup.outputs.ZIP }} + name: webrtc-builds path: ${{ steps.setup.outputs.ZIP }} diff --git a/livekit-ffi/.gitignore b/livekit-ffi/.gitignore new file mode 100644 index 000000000..7c18ec7e5 --- /dev/null +++ b/livekit-ffi/.gitignore @@ -0,0 +1 @@ +WEBRTC_LICENSE.md \ No newline at end of file diff --git a/livekit-ffi/build.rs b/livekit-ffi/build.rs index 9db1985bf..7fa2ec696 100644 --- a/livekit-ffi/build.rs +++ b/livekit-ffi/build.rs @@ -13,13 +13,27 @@ // limitations under the License. use std::env; +use std::path::Path; fn main() { if env::var("DOCS_RS").is_ok() { return; } + webrtc_sys_build::download_webrtc().unwrap(); if env::var("CARGO_CFG_TARGET_OS").unwrap() == "android" { webrtc_sys_build::configure_jni_symbols().unwrap(); } + + { + // Copy the webrtc license to CARGO_MANIFEST_DIR + // (used by the ffi release action) + let webrtc_dir = webrtc_sys_build::webrtc_dir(); + let license = webrtc_dir.join("LICENSE.md"); + let target_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); + + let out_file = Path::new(&target_dir).join("WEBRTC_LICENSE.md"); + + std::fs::copy(license, out_file).unwrap(); + } }