Skip to content

fix(install): retry GitHub downloads, add missing jq pre-req check (#… #111

fix(install): retry GitHub downloads, add missing jq pre-req check (#…

fix(install): retry GitHub downloads, add missing jq pre-req check (#… #111

Workflow file for this run

# Copyright 2023 LiveKit, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: Release
on:
push:
tags:
- v*
permissions:
contents: write
jobs:
# GoReleaser runs on macOS so the darwin binary builds natively (CoreAudio
# frameworks only exist on a Mac); zig still cross-compiles linux + windows
# from here. Produces all binaries, archives, checksums, and the GitHub
# release. Docker is handled by the separate job below (macOS has no Docker).
release:
name: Release
runs-on: macos-latest
steps:
- name: Checkout Git LFS
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
lfs: 'true'
# pkg/portaudio/pa_src holds the vendored PortAudio C source the cgo
# build links against.
submodules: true
- name: Verify version.go matches tag
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
CODE_VERSION=$(sed -n 's/.*Version = "\([^"]*\)".*/\1/p' version.go)
echo "Tag version: v$TAG_VERSION"
echo "Code version: $CODE_VERSION"
if [ "$TAG_VERSION" != "$CODE_VERSION" ]; then
echo "ERROR: Version mismatch!"
echo " Tag: v$TAG_VERSION"
echo " version.go: $CODE_VERSION"
exit 1
fi
echo "✓ Versions match: $CODE_VERSION"
- name: Verify server-sdk-go version
run: |
livekit_cli_ver=${GITHUB_REF#refs/tags/}
server_sdk_go_ver=$(git ls-remote --tags --sort='v:refname' https://github.com/livekit/server-sdk-go.git \
| awk -F'refs/tags/' '{print $2}' \
| grep -E '^v[0-9]+\.[0-9]+' \
| tail -n1)
livekit_cli_major_minor=$(echo "$livekit_cli_ver" | sed -E 's/^v([0-9]+\.[0-9]+)\..*/\1/')
server_sdk_go_major_minor=$(echo "$server_sdk_go_ver" | sed -E 's/^v([0-9]+\.[0-9]+)\..*/\1/')
echo "livekit-cli: $livekit_cli_ver ($livekit_cli_major_minor)"
echo "server-sdk-go: $server_sdk_go_ver ($server_sdk_go_major_minor)"
if [ "$livekit_cli_major_minor" != "$server_sdk_go_major_minor" ]; then
echo "version mismatch: livekit-cli ($livekit_cli_major_minor) ≠ server-sdk-go ($server_sdk_go_major_minor)"
exit 1
fi
echo "versions match ($livekit_cli_major_minor)"
- run: git lfs pull
- name: Fetch all tags
run: git fetch --force --tags
- name: Set up Go
uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.mod
cache: true
- name: Install Zig
uses: mlugg/setup-zig@d1434d08867e3ee9daa34448df10607b98908d29 # v2
with:
version: 0.14.1
- name: Cache cross-compile inputs
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
with:
path: .cross
key: cross-${{ runner.os }}-zig0.14.1-alsa1.2.12-${{ hashFiles('scripts/setup-cross.sh') }}
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@ec59f474b9834571250b370d4735c50f8e2d1e29 # v7
with:
distribution: goreleaser
version: latest
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# goreleaser-action runs goreleaser via a Node wrapper that doesn't
# forward PWD; the .goreleaser.yaml CGO flags template {{ .Env.PWD }}
# to locate .cross/<target>. Provide it explicitly.
PWD: ${{ github.workspace }}
- name: Stage linux binaries for Docker
run: |
mkdir -p docker-bin
cp dist/lk-linux-amd64_*/lk docker-bin/lk_linux_amd64
cp dist/lk-linux-arm64_*/lk docker-bin/lk_linux_arm64
- name: Upload linux binaries
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: docker-bin
path: docker-bin/
if-no-files-found: error
# Build + push multi-arch Docker images on Linux (where the Docker daemon
# lives), reusing the cgo linux binaries staged by the release job.
docker:
name: Release to Docker
needs: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
- name: Download linux binaries
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: docker-bin
path: .
- name: Restore executable bit
run: chmod +x lk_linux_amd64 lk_linux_arm64
- name: Docker meta
id: meta
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6
with:
images: livekit/livekit-cli
tags: |
type=semver,pattern=v{{version}}
type=semver,pattern=v{{major}}.{{minor}}
- name: Set up QEMU
uses: docker/setup-qemu-action@96fe6ef7f33517b61c61be40b68a1882f3264fb8 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4
- name: Login to DockerHub
uses: docker/login-action@af1e73f918a031802d376d3c8bbc3fe56130a9b0 # v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7
with:
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}