Skip to content

Commit d40d4d3

Browse files
committed
knope
1 parent 02c24c5 commit d40d4d3

14 files changed

Lines changed: 179 additions & 282 deletions

File tree

.github/workflows/ffi-builds.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ on:
1717
push:
1818
branches: ["main"]
1919
tags:
20-
- "rust-sdks/livekit-ffi@*"
20+
- "livekit-ffi/v*"
2121
workflow_dispatch:
2222
workflow_call:
2323
inputs:
@@ -212,12 +212,12 @@ jobs:
212212
path: ${{ matrix.name }}.zip
213213

214214
release:
215-
name: Release to GH (Draft)
215+
name: Upload artifacts and publish GH release
216216
runs-on: ubuntu-latest
217217
needs: build
218218
permissions:
219219
contents: write
220-
if: startsWith(inputs.tag || github.ref_name, 'rust-sdks/livekit-ffi@')
220+
if: startsWith(inputs.tag || github.ref_name, 'livekit-ffi/v')
221221
env:
222222
GH_TOKEN: ${{ github.token }}
223223
steps:
@@ -230,7 +230,7 @@ jobs:
230230
merge-multiple: true
231231
path: ${{ github.workspace }}/ffi-builds
232232

233-
- name: Create draft release
233+
- name: Upload artifacts and publish release
234234
run: |
235-
gh release create ${{ env.TAG_NAME }} --draft --title "${{ env.TAG_NAME }}"
236235
gh release upload ${{ env.TAG_NAME }} ${{ github.workspace }}/ffi-builds/*
236+
gh release edit ${{ env.TAG_NAME }} --draft=false

.github/workflows/node-builds.yml

Lines changed: 6 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -6,62 +6,14 @@ permissions:
66

77
on:
88
workflow_dispatch:
9-
inputs:
10-
tag:
11-
required: true
12-
type: string
139
workflow_call:
14-
inputs:
15-
tag:
16-
required: true
17-
type: string
1810

1911
env:
2012
CARGO_TERM_COLOR: always
21-
TAG_NAME: ${{ inputs.tag || github.ref_name }}
2213
APP_NAME: rtc-node
2314

2415
jobs:
25-
bump_version:
26-
runs-on: macos-15
27-
outputs:
28-
commit_sha: ${{ steps.commit.outputs.commit_long_sha }}
29-
steps:
30-
- uses: actions/checkout@v6
31-
32-
- uses: pnpm/action-setup@v4
33-
with:
34-
package_json_file: livekit-ffi-node-bindings/package.json
35-
36-
- name: Setup node
37-
uses: actions/setup-node@v6
38-
with:
39-
node-version: 24
40-
cache: pnpm
41-
cache-dependency-path: livekit-ffi-node-bindings/pnpm-lock.yaml
42-
43-
- working-directory: livekit-ffi-node-bindings
44-
run: pnpm install
45-
46-
- name: Set package version from tag
47-
working-directory: livekit-ffi-node-bindings
48-
run: |
49-
# Extract version from tag (e.g., rust-sdks/livekit-ffi@0.12.43 -> 0.12.43)
50-
VERSION=$(echo "${{ env.TAG_NAME }}" | sed 's/.*@//')
51-
echo "Setting package version to $VERSION"
52-
npm version $VERSION --no-git-tag-version
53-
pnpm run ci:version
54-
55-
- name: Add changes
56-
id: commit
57-
uses: EndBug/add-and-commit@v9
58-
with:
59-
add: '["**/package.json"]'
60-
default_author: github_actions
61-
message: bump livekit-ffi-node-binding version
62-
6316
build:
64-
needs: bump_version
6517
strategy:
6618
fail-fast: false
6719
matrix:
@@ -94,8 +46,7 @@ jobs:
9446
- uses: actions/checkout@v6
9547
with:
9648
submodules: recursive
97-
ref: ${{ needs.bump_version.outputs.commit_sha }}
98-
fetch-depth: 0
49+
9950
- uses: pnpm/action-setup@v4
10051
with:
10152
package_json_file: livekit-ffi-node-bindings/package.json
@@ -172,7 +123,7 @@ jobs:
172123
cd /workspace
173124
cd livekit-ffi-node-bindings
174125
CI=true pnpm install
175-
pnpm build --target $TARGET
126+
pnpm build --target $TARGET
176127
"
177128
'
178129
@@ -190,31 +141,26 @@ jobs:
190141

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

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

207-
commit_and_release:
208-
needs: [bump_version, build]
209-
name: Commit and Release
157+
publish:
158+
needs: build
159+
name: Publish to npm
210160
runs-on: ubuntu-latest
211161
steps:
212162
- uses: actions/checkout@v6
213163

214-
- run: git fetch origin ${{ needs.bump_version.outputs.commit_sha }}
215-
216-
- run: git reset --hard ${{ needs.bump_version.outputs.commit_sha }}
217-
218164
- uses: pnpm/action-setup@v4
219165
with:
220166
package_json_file: livekit-ffi-node-bindings/package.json
@@ -241,13 +187,6 @@ jobs:
241187
name: js-bindings
242188
path: livekit-ffi-node-bindings
243189

244-
- name: Add changes
245-
uses: EndBug/add-and-commit@v9
246-
with:
247-
add: '["livekit-ffi-node-bindings/native.js", "livekit-ffi-node-bindings/native.d.ts"]'
248-
default_author: github_actions
249-
message: update js bindings for release
250-
251190
- name: Move artifacts
252191
run: pnpm run ci:artifacts
253192
working-directory: livekit-ffi-node-bindings
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Prepare Release
2+
3+
on:
4+
push:
5+
branches: [main]
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
prepare-release:
13+
runs-on: ubuntu-latest
14+
if: "!contains(github.event.head_commit.message, 'chore: prepare release')"
15+
concurrency:
16+
group: prepare-release
17+
cancel-in-progress: true
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
token: ${{ secrets.PAT }}
23+
24+
- name: Configure Git
25+
run: |
26+
git config user.name "github-actions[bot]"
27+
git config user.email "github-actions[bot]@users.noreply.github.com"
28+
29+
- uses: knope-dev/action@v2
30+
31+
- run: knope prepare-release
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.PAT }}

.github/workflows/release.yml

Lines changed: 42 additions & 103 deletions
Original file line numberDiff line numberDiff line change
@@ -1,130 +1,69 @@
11
name: Release
22

3+
on:
4+
pull_request:
5+
types: [closed]
6+
branches: [main]
7+
38
permissions:
4-
id-token: write # Required for OIDC
5-
pull-requests: write
9+
id-token: write
610
contents: write
7-
actions: write
8-
9-
on:
10-
push:
11-
branches:
12-
- main
1311

1412
jobs:
15-
# Release unpublished packages.
16-
release-plz-release:
17-
name: Release-plz release
13+
release:
1814
runs-on: ubuntu-latest
19-
if: ${{ github.repository_owner == 'livekit' }}
20-
permissions:
21-
contents: write
15+
if: github.event.pull_request.merged && startsWith(github.head_ref, 'knope/release')
2216
outputs:
2317
ffi_tag: ${{ steps.ffi.outputs.ffi_tag }}
2418
steps:
25-
- name: Checkout repository
26-
uses: actions/checkout@v4
19+
- uses: actions/checkout@v4
2720
with:
2821
fetch-depth: 0
29-
submodules: recursive
30-
- name: Install Rust toolchain
31-
uses: dtolnay/rust-toolchain@stable
32-
- name: Install VA-API/NVIDIA drivers and other dependencies for build
33-
run: |
34-
sudo apt update -y
35-
sudo apt install \
36-
libnvidia-compute-570 \
37-
libnvidia-decode-570 \
38-
nvidia-cuda-dev \
39-
libasound2-dev \
40-
libssl-dev \
41-
libx11-dev \
42-
libgl1-mesa-dev \
43-
libxext-dev \
44-
libva-dev \
45-
libdrm-dev \
46-
libgbm-dev \
47-
libxfixes-dev \
48-
libxdamage-dev \
49-
libxrandr-dev \
50-
libxcomposite-dev \
51-
libglib2.0-dev -y
5222

53-
- name: Run release-plz
54-
uses: release-plz/action@v0.5
55-
id: release-plz
56-
with:
57-
command: release
23+
- uses: knope-dev/action@v2
24+
25+
- name: Create tags and GitHub releases
26+
run: knope release
5827
env:
5928
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
60-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
61-
- name: Extract ffi tag
29+
30+
- name: Detect livekit-ffi tag
6231
id: ffi
63-
env:
64-
RELEASES: ${{ steps.release-plz.outputs.releases }}
6532
run: |
6633
set -e
67-
ffi_tag=$(echo "$RELEASES" | jq -r '.[].tag' | grep 'rust-sdks/livekit-ffi@' || true)
68-
echo "ffi_tag=$ffi_tag"
69-
echo "ffi_tag=$ffi_tag" >> $GITHUB_OUTPUT
34+
ffi_tag=$(git tag --points-at HEAD | grep '^livekit-ffi/v' || true)
35+
echo "ffi_tag=$ffi_tag" >> "$GITHUB_OUTPUT"
36+
37+
publish-crates:
38+
runs-on: ubuntu-latest
39+
needs: release
40+
steps:
41+
- uses: actions/checkout@v4
42+
with:
43+
submodules: recursive
44+
45+
- uses: dtolnay/rust-toolchain@stable
46+
47+
- name: Install cargo-release
48+
run: cargo install cargo-release
49+
50+
- name: Publish to crates.io
51+
run: cargo release publish --workspace --execute --no-confirm --no-verify
52+
env:
53+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
7054

7155
call-ffi:
7256
name: Call FFI Builds
73-
if: ${{ needs.release-plz-release.outputs.ffi_tag != '' }}
57+
if: needs.release.outputs.ffi_tag != ''
7458
uses: ./.github/workflows/ffi-builds.yml
75-
needs: release-plz-release
59+
needs: release
7660
with:
77-
tag: ${{ needs.release-plz-release.outputs.ffi_tag }}
61+
tag: ${{ needs.release.outputs.ffi_tag }}
7862

7963
call-node-ffi:
80-
name: Call node FFI Builds
81-
if: ${{ needs.release-plz-release.outputs.ffi_tag != '' }}
64+
name: Call Node FFI Builds
65+
if: needs.release.outputs.ffi_tag != ''
8266
uses: ./.github/workflows/node-builds.yml
83-
needs: release-plz-release
67+
needs: release
8468
with:
85-
tag: ${{ needs.release-plz-release.outputs.ffi_tag }}
86-
87-
# Create a PR with the new versions and changelog, preparing the next release.
88-
release-plz-pr:
89-
name: Release-plz PR
90-
runs-on: ubuntu-latest
91-
permissions:
92-
contents: write
93-
pull-requests: write
94-
concurrency:
95-
group: release-plz-${{ github.ref }}
96-
cancel-in-progress: false
97-
steps:
98-
- name: Checkout repository
99-
uses: actions/checkout@v4
100-
with:
101-
fetch-depth: 0
102-
- name: Install Rust toolchain
103-
uses: dtolnay/rust-toolchain@stable
104-
- name: Install VA-API/NVIDIA drivers and other dependencies for build
105-
run: |
106-
sudo apt update -y
107-
sudo apt install \
108-
libnvidia-compute-570 \
109-
libnvidia-decode-570 \
110-
nvidia-cuda-dev \
111-
libasound2-dev \
112-
libssl-dev \
113-
libx11-dev \
114-
libgl1-mesa-dev \
115-
libxext-dev \
116-
libva-dev \
117-
libdrm-dev \
118-
libgbm-dev \
119-
libxfixes-dev \
120-
libxdamage-dev \
121-
libxrandr-dev \
122-
libxcomposite-dev \
123-
libglib2.0-dev -y
124-
- name: Run release-plz
125-
uses: release-plz/action@v0.5
126-
with:
127-
command: release-pr
128-
env:
129-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130-
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
69+
tag: ${{ needs.release.outputs.ffi_tag }}

0 commit comments

Comments
 (0)