Skip to content
Closed

knope #906

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ffi-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:
push:
branches: ["main"]
tags:
- "rust-sdks/livekit-ffi@*"
- "livekit-ffi/v*"
workflow_dispatch:
workflow_call:
inputs:
Expand Down Expand Up @@ -212,12 +212,12 @@ jobs:
path: ${{ matrix.name }}.zip

release:
name: Release to GH (Draft)
name: Upload artifacts and publish GH release
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
if: startsWith(inputs.tag || github.ref_name, 'rust-sdks/livekit-ffi@')
if: startsWith(inputs.tag || github.ref_name, 'livekit-ffi/v')
env:
GH_TOKEN: ${{ github.token }}
steps:
Expand All @@ -230,7 +230,7 @@ jobs:
merge-multiple: true
path: ${{ github.workspace }}/ffi-builds

- name: Create draft release
- name: Upload artifacts and publish release
run: |
gh release create ${{ env.TAG_NAME }} --draft --title "${{ env.TAG_NAME }}"
gh release upload ${{ env.TAG_NAME }} ${{ github.workspace }}/ffi-builds/*
gh release edit ${{ env.TAG_NAME }} --draft=false
80 changes: 12 additions & 68 deletions .github/workflows/node-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,62 +6,14 @@ permissions:

on:
workflow_dispatch:
inputs:
tag:
required: true
type: string
workflow_call:
inputs:
tag:
required: true
type: string

env:
CARGO_TERM_COLOR: always
TAG_NAME: ${{ inputs.tag || github.ref_name }}
APP_NAME: rtc-node

jobs:
bump_version:
runs-on: macos-15
outputs:
commit_sha: ${{ steps.commit.outputs.commit_long_sha }}
steps:
- uses: actions/checkout@v6

- uses: pnpm/action-setup@v4
with:
package_json_file: livekit-ffi-node-bindings/package.json

- name: Setup node
uses: actions/setup-node@v6
with:
node-version: 24
cache: pnpm
cache-dependency-path: livekit-ffi-node-bindings/pnpm-lock.yaml

- working-directory: livekit-ffi-node-bindings
run: pnpm install

- name: Set package version from tag
working-directory: livekit-ffi-node-bindings
run: |
# Extract version from tag (e.g., rust-sdks/livekit-ffi@0.12.43 -> 0.12.43)
VERSION=$(echo "${{ env.TAG_NAME }}" | sed 's/.*@//')
echo "Setting package version to $VERSION"
npm version $VERSION --no-git-tag-version
pnpm run ci:version

- name: Add changes
id: commit
uses: EndBug/add-and-commit@v9
with:
add: '["**/package.json"]'
default_author: github_actions
message: bump livekit-ffi-node-binding version

build:
needs: bump_version
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -94,8 +46,7 @@ jobs:
- uses: actions/checkout@v6
with:
submodules: recursive
ref: ${{ needs.bump_version.outputs.commit_sha }}
fetch-depth: 0

- uses: pnpm/action-setup@v4
with:
package_json_file: livekit-ffi-node-bindings/package.json
Expand Down Expand Up @@ -172,7 +123,7 @@ jobs:
cd /workspace
cd livekit-ffi-node-bindings
CI=true pnpm install
pnpm build --target $TARGET
pnpm build --target $TARGET
"
'

Expand All @@ -190,31 +141,26 @@ jobs:

- name: Upload binary artifact
uses: actions/upload-artifact@v4
if: github.event_name != 'pull-request'
with:
name: native-bindings-${{ matrix.target }}
path: livekit-ffi-node-bindings/${{ env.APP_NAME }}.*.node
if-no-files-found: error

- name: Upload JS
uses: actions/upload-artifact@v4
if: ${{ github.event_name != 'pull-request' && matrix.os == 'macos-15' }}
if: ${{ matrix.os == 'macos-15' }}
with:
name: js-bindings
path: livekit-ffi-node-bindings/native.*
if-no-files-found: error

commit_and_release:
needs: [bump_version, build]
name: Commit and Release
publish:
needs: build
name: Publish to npm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- run: git fetch origin ${{ needs.bump_version.outputs.commit_sha }}

- run: git reset --hard ${{ needs.bump_version.outputs.commit_sha }}

- uses: pnpm/action-setup@v4
with:
package_json_file: livekit-ffi-node-bindings/package.json
Expand All @@ -241,13 +187,6 @@ jobs:
name: js-bindings
path: livekit-ffi-node-bindings

- name: Add changes
uses: EndBug/add-and-commit@v9
with:
add: '["livekit-ffi-node-bindings/native.js", "livekit-ffi-node-bindings/native.d.ts"]'
default_author: github_actions
message: update js bindings for release

- name: Move artifacts
run: pnpm run ci:artifacts
working-directory: livekit-ffi-node-bindings
Expand All @@ -256,6 +195,11 @@ jobs:
run: ls -R ./livekit-ffi-node-bindings/npm
shell: bash

- name: Echo changes
run: |
git status
git diff

- name: Publish
working-directory: livekit-ffi-node-bindings
run: pnpm publish -r
run: pnpm publish -r --no-git-checks
33 changes: 33 additions & 0 deletions .github/workflows/prepare-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Prepare Release

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
prepare-release:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'chore: prepare release')"
concurrency:
group: prepare-release
cancel-in-progress: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT }}

- name: Configure Git
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

- uses: knope-dev/action@v2

- run: knope prepare-release
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
145 changes: 42 additions & 103 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,130 +1,69 @@
name: Release

on:
pull_request:
types: [closed]
branches: [main]

permissions:
id-token: write # Required for OIDC
pull-requests: write
id-token: write
contents: write
actions: write

on:
push:
branches:
- main

jobs:
# Release unpublished packages.
release-plz-release:
name: Release-plz release
release:
runs-on: ubuntu-latest
if: ${{ github.repository_owner == 'livekit' }}
permissions:
contents: write
if: github.event.pull_request.merged && startsWith(github.head_ref, 'knope/release')
outputs:
ffi_tag: ${{ steps.ffi.outputs.ffi_tag }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install VA-API/NVIDIA drivers and other dependencies for build
run: |
sudo apt update -y
sudo apt install \
libnvidia-compute-570 \
libnvidia-decode-570 \
nvidia-cuda-dev \
libasound2-dev \
libssl-dev \
libx11-dev \
libgl1-mesa-dev \
libxext-dev \
libva-dev \
libdrm-dev \
libgbm-dev \
libxfixes-dev \
libxdamage-dev \
libxrandr-dev \
libxcomposite-dev \
libglib2.0-dev -y

- name: Run release-plz
uses: release-plz/action@v0.5
id: release-plz
with:
command: release
- uses: knope-dev/action@v2

- name: Create tags and GitHub releases
run: knope release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
- name: Extract ffi tag

- name: Detect livekit-ffi tag
id: ffi
env:
RELEASES: ${{ steps.release-plz.outputs.releases }}
run: |
set -e
ffi_tag=$(echo "$RELEASES" | jq -r '.[].tag' | grep 'rust-sdks/livekit-ffi@' || true)
echo "ffi_tag=$ffi_tag"
echo "ffi_tag=$ffi_tag" >> $GITHUB_OUTPUT
ffi_tag=$(git tag --points-at HEAD | grep '^livekit-ffi/v' || true)
echo "ffi_tag=$ffi_tag" >> "$GITHUB_OUTPUT"

publish-crates:
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- uses: dtolnay/rust-toolchain@stable

- name: Install cargo-release
run: cargo install cargo-release

- name: Publish to crates.io
run: cargo release publish --workspace --execute --no-confirm --no-verify
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}

call-ffi:
name: Call FFI Builds
if: ${{ needs.release-plz-release.outputs.ffi_tag != '' }}
if: needs.release.outputs.ffi_tag != ''
uses: ./.github/workflows/ffi-builds.yml
needs: release-plz-release
needs: release
with:
tag: ${{ needs.release-plz-release.outputs.ffi_tag }}
tag: ${{ needs.release.outputs.ffi_tag }}

call-node-ffi:
name: Call node FFI Builds
if: ${{ needs.release-plz-release.outputs.ffi_tag != '' }}
name: Call Node FFI Builds
if: needs.release.outputs.ffi_tag != ''
uses: ./.github/workflows/node-builds.yml
needs: release-plz-release
needs: release
with:
tag: ${{ needs.release-plz-release.outputs.ffi_tag }}

# Create a PR with the new versions and changelog, preparing the next release.
release-plz-pr:
name: Release-plz PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
concurrency:
group: release-plz-${{ github.ref }}
cancel-in-progress: false
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install VA-API/NVIDIA drivers and other dependencies for build
run: |
sudo apt update -y
sudo apt install \
libnvidia-compute-570 \
libnvidia-decode-570 \
nvidia-cuda-dev \
libasound2-dev \
libssl-dev \
libx11-dev \
libgl1-mesa-dev \
libxext-dev \
libva-dev \
libdrm-dev \
libgbm-dev \
libxfixes-dev \
libxdamage-dev \
libxrandr-dev \
libxcomposite-dev \
libglib2.0-dev -y
- name: Run release-plz
uses: release-plz/action@v0.5
with:
command: release-pr
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
tag: ${{ needs.release.outputs.ffi_tag }}
Loading
Loading