Skip to content

Commit ce3301c

Browse files
authored
update workflows to use workflow_call (#681)
* update workflows to use workflow_call * unable to use env. in if
1 parent eadb1b6 commit ce3301c

File tree

2 files changed

+23
-11
lines changed

2 files changed

+23
-11
lines changed

.github/workflows/ffi-builds.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,15 @@ on:
1919
tags:
2020
- "rust-sdks/livekit-ffi@*"
2121
workflow_dispatch:
22+
workflow_call:
23+
inputs:
24+
tag:
25+
required: false
26+
type: string
2227

2328
env:
2429
CARGO_TERM_COLOR: always
30+
TAG_NAME: ${{ inputs.tag || github.ref_name }}
2531

2632
jobs:
2733
build:
@@ -207,7 +213,7 @@ jobs:
207213
needs: build
208214
permissions:
209215
contents: write
210-
if: startsWith(github.ref, 'refs/tags/rust-sdks/livekit-ffi')
216+
if: startsWith(inputs.tag || github.ref_name, 'rust-sdks/livekit-ffi@')
211217
env:
212218
GH_TOKEN: ${{ github.token }}
213219
steps:
@@ -222,5 +228,5 @@ jobs:
222228

223229
- name: Create draft release
224230
run: |
225-
gh release create ${{ github.ref_name }} --draft --title "${{ github.ref_name }}"
226-
gh release upload ${{ github.ref_name }} ${{ github.workspace }}/ffi-builds/*
231+
gh release create ${{ env.TAG_NAME }} --draft --title "${{ env.TAG_NAME }}"
232+
gh release upload ${{ env.TAG_NAME }} ${{ github.workspace }}/ffi-builds/*

.github/workflows/release.yml

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ jobs:
1818
if: ${{ github.repository_owner == 'livekit' }}
1919
permissions:
2020
contents: write
21+
outputs:
22+
ffi_tag: ${{ steps.ffi.outputs.ffi_tag }}
2123
steps:
2224
- name: Checkout repository
2325
uses: actions/checkout@v4
@@ -34,19 +36,23 @@ jobs:
3436
env:
3537
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3638
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
37-
- name: Trigger FFI workflow if needed
39+
- name: Extract ffi tag
40+
id: ffi
3841
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4042
RELEASES: ${{ steps.release-plz.outputs.releases }}
4143
run: |
4244
set -e
43-
echo "releases: $RELEASES"
44-
4545
ffi_tag=$(echo "$RELEASES" | jq -r '.[].tag' | grep 'rust-sdks/livekit-ffi@' || true)
46-
if [ -n "$ffi_tag" ]; then
47-
echo "Found ffi_tag: $ffi_tag"
48-
gh workflow run ffi-builds.yml --ref $ffi_tag
49-
fi
46+
echo "ffi_tag=$ffi_tag"
47+
echo "ffi_tag=$ffi_tag" >> $GITHUB_OUTPUT
48+
49+
call-ffi:
50+
name: Call FFI Builds
51+
if: ${{ needs.release-plz-release.outputs.ffi_tag != '' }}
52+
uses: ./.github/workflows/ffi-builds.yml
53+
needs: release-plz-release
54+
with:
55+
tag: ${{ needs.release-plz-release.outputs.ffi_tag }}
5056

5157
# Create a PR with the new versions and changelog, preparing the next release.
5258
release-plz-pr:

0 commit comments

Comments
 (0)