diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3504531..2d95b38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,4 +28,23 @@ jobs: with: name: server-log-${{ matrix.os }} path: ${{ steps.server.outputs.log-path }} + if-no-files-found: error + + test-version-input: + name: Test version input + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + - name: Run pinned LiveKit server + id: server + uses: ./ + with: + github-token: ${{ github.token }} + version: v1.13.3 + - name: Upload server log + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + name: server-log-version-input + path: ${{ steps.server.outputs.log-path }} if-no-files-found: error \ No newline at end of file diff --git a/README.md b/README.md index 83b344c..8c3070f 100644 --- a/README.md +++ b/README.md @@ -10,14 +10,19 @@ Install and run a LiveKit server in development mode for end-to-end testing. - uses: livekit/dev-server-action@v1 with: github-token: ${{ github.token }} + version: v1.13.3 ``` ## Inputs -| Name | Required | Default | Description | -| -------------- | -------- | ------- | -------------------------------------------------------------------- | -| `github-token` | Yes | | Token used to download the LiveKit server release. | -| `config` | No | `""` | Server configuration YAML +| Name | Required | Default | Description | +| -------------- | -------- | -------- | ------------------------------------------------------------------------ | +| `github-token` | Yes | | Token used to download the LiveKit server release. | +| `config` | No | `""` | Server configuration YAML | +| `version` | No | `latest` | LiveKit server release to install. Accepts `latest`, `v1.13.3`, or `1.13.3`. | + +`version` is supported on Linux and Windows release downloads. macOS uses the +Homebrew package and only supports the latest version. ## Outputs diff --git a/action.yml b/action.yml index 3c1a92f..f5e4b33 100644 --- a/action.yml +++ b/action.yml @@ -12,6 +12,10 @@ inputs: description: Server configuration YAML required: false default: "" + version: + description: LiveKit server release version to install. Use latest, v1.13.3, or 1.13.3. + required: false + default: latest outputs: pid: description: Process ID @@ -22,25 +26,41 @@ outputs: runs: using: composite steps: + - name: Validate macOS version + if: runner.os == 'macOS' && inputs.version != 'latest' && inputs.version != '' + shell: bash + run: | + echo "::error::The version input is not supported on macOS because LiveKit does not publish macOS release artifacts. Use version: latest or omit the input." + exit 1 - name: Brew install if: runner.os == 'macOS' shell: bash env: HOMEBREW_NO_ENV_HINTS: 1 run: brew install livekit - - name: Resolve latest version + - name: Resolve version if: runner.os == 'Linux' || runner.os == 'Windows' id: version shell: bash env: GH_TOKEN: ${{ inputs.github-token }} + LIVEKIT_VERSION: ${{ inputs.version }} run: | - tag="$(gh api repos/livekit/livekit/releases/latest --jq '.tag_name')" + if [ -z "$LIVEKIT_VERSION" ] || [ "$LIVEKIT_VERSION" = "latest" ]; then + tag="$(gh api repos/livekit/livekit/releases/latest --jq '.tag_name')" + else + tag="$LIVEKIT_VERSION" + case "$tag" in + v*) ;; + *) tag="v$tag" ;; + esac + fi if [ -z "$tag" ]; then echo "::error::Failed to resolve version tag" exit 1 fi - echo "Latest version tag: $tag" + gh release view "$tag" --repo livekit/livekit >/dev/null + echo "Version tag: $tag" echo "tag=$tag" >> "$GITHUB_OUTPUT" - name: Download release artifact if: runner.os == 'Linux' || runner.os == 'Windows'