|
1 | 1 | name: Release |
2 | 2 |
|
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [closed] |
| 6 | + branches: [main] |
| 7 | + |
3 | 8 | permissions: |
4 | | - id-token: write # Required for OIDC |
5 | | - pull-requests: write |
| 9 | + id-token: write |
6 | 10 | contents: write |
7 | | - actions: write |
8 | | - |
9 | | -on: |
10 | | - push: |
11 | | - branches: |
12 | | - - main |
13 | 11 |
|
14 | 12 | jobs: |
15 | | - # Release unpublished packages. |
16 | | - release-plz-release: |
17 | | - name: Release-plz release |
| 13 | + release: |
18 | 14 | 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') |
22 | 16 | outputs: |
23 | 17 | ffi_tag: ${{ steps.ffi.outputs.ffi_tag }} |
24 | 18 | steps: |
25 | | - - name: Checkout repository |
26 | | - uses: actions/checkout@v4 |
| 19 | + - uses: actions/checkout@v4 |
27 | 20 | with: |
28 | 21 | 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 |
52 | 22 |
|
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 |
58 | 27 | env: |
59 | 28 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
60 | | - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }} |
61 | | - - name: Extract ffi tag |
| 29 | + |
| 30 | + - name: Detect livekit-ffi tag |
62 | 31 | id: ffi |
63 | | - env: |
64 | | - RELEASES: ${{ steps.release-plz.outputs.releases }} |
65 | 32 | run: | |
66 | 33 | 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 }} |
70 | 54 |
|
71 | 55 | call-ffi: |
72 | 56 | name: Call FFI Builds |
73 | | - if: ${{ needs.release-plz-release.outputs.ffi_tag != '' }} |
| 57 | + if: needs.release.outputs.ffi_tag != '' |
74 | 58 | uses: ./.github/workflows/ffi-builds.yml |
75 | | - needs: release-plz-release |
| 59 | + needs: release |
76 | 60 | with: |
77 | | - tag: ${{ needs.release-plz-release.outputs.ffi_tag }} |
| 61 | + tag: ${{ needs.release.outputs.ffi_tag }} |
78 | 62 |
|
79 | 63 | 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 != '' |
82 | 66 | uses: ./.github/workflows/node-builds.yml |
83 | | - needs: release-plz-release |
| 67 | + needs: release |
84 | 68 | 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