Release with GoReleaser. Allow start without key configuration (#788)
This commit is contained in:
@@ -50,9 +50,9 @@ jobs:
|
||||
args: build
|
||||
|
||||
- name: Static Check
|
||||
uses: dominikh/staticcheck-action@v1.1.0
|
||||
uses: dominikh/staticcheck-action@v1.2.0
|
||||
with:
|
||||
version: "2021.1.1"
|
||||
version: "2022.1"
|
||||
|
||||
- name: Test
|
||||
run: |
|
||||
|
||||
@@ -11,57 +11,57 @@ jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/go/bin
|
||||
~/.cache
|
||||
key: ${{ runner.os }}-livekit-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-livekit-
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
livekit/livekit-server
|
||||
# generate Docker tags based on the following events/attributes
|
||||
tags: |
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/go/bin
|
||||
~/.cache
|
||||
key: ${{ runner.os }}-livekit-${{ hashFiles('**/go.sum') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-livekit-
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v3
|
||||
with:
|
||||
# list of Docker images to use as base name for tags
|
||||
images: |
|
||||
livekit/livekit-server
|
||||
# generate Docker tags based on the following events/attributes
|
||||
tags: |
|
||||
type=semver,pattern=v{{version}}
|
||||
type=semver,pattern=v{{major}}.{{minor}}
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.17
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Download Go modules
|
||||
run: go mod download
|
||||
- name: Download Go modules
|
||||
run: go mod download
|
||||
|
||||
- name: Generate code
|
||||
uses: magefile/mage-action@v1
|
||||
with:
|
||||
version: latest
|
||||
args: generate
|
||||
- name: Generate code
|
||||
uses: magefile/mage-action@v1
|
||||
with:
|
||||
version: latest
|
||||
args: generate
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
# only publish on version tags
|
||||
tags:
|
||||
- 'v*.*.*'
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
release:
|
||||
runs-on: macos-12
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Fetch all tags
|
||||
run: git fetch --force --tags
|
||||
- uses: actions/cache@v2
|
||||
with:
|
||||
path: |
|
||||
~/go/pkg/mod
|
||||
~/go/bin
|
||||
~/.cache
|
||||
key: livekit-server
|
||||
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
with:
|
||||
go-version: 1.18
|
||||
|
||||
- name: Run GoReleaser
|
||||
uses: goreleaser/goreleaser-action@v2
|
||||
with:
|
||||
distribution: goreleaser
|
||||
version: latest
|
||||
args: release --rm-dist
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -25,3 +25,5 @@ proto/
|
||||
|
||||
# IDE
|
||||
.idea
|
||||
|
||||
dist/
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
before:
|
||||
hooks:
|
||||
- go mod tidy
|
||||
- go generate ./...
|
||||
builds:
|
||||
# darwin build requires CGO, declaring it separately
|
||||
- id: darwin
|
||||
env:
|
||||
- CGO_ENABLED=1
|
||||
main: ./cmd/server
|
||||
binary: livekit-server
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
goos:
|
||||
- darwin
|
||||
- id: livekit
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./cmd/server
|
||||
binary: livekit-server
|
||||
goarm:
|
||||
- "7"
|
||||
goarch:
|
||||
- amd64
|
||||
- arm64
|
||||
- arm
|
||||
goos:
|
||||
- linux
|
||||
- windows
|
||||
archives:
|
||||
- format_overrides:
|
||||
- goos: windows
|
||||
format: zip
|
||||
replacements:
|
||||
darwin: mac
|
||||
files:
|
||||
- LICENSE
|
||||
nfpms:
|
||||
- package_name: livekit
|
||||
vendor: LiveKit
|
||||
homepage: https://livekit.io
|
||||
description: |-
|
||||
LiveKit is a high-performance WebRTC server. It provides software components for building multi-user, real-time, media applications.
|
||||
license: Apache 2.0
|
||||
|
||||
formats:
|
||||
- deb
|
||||
- rpm
|
||||
|
||||
recommends:
|
||||
- redis-server
|
||||
release:
|
||||
github:
|
||||
owner: livekit
|
||||
name: livekit
|
||||
draft: true
|
||||
prerelease: auto
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
gomod:
|
||||
proxy: true
|
||||
mod: mod
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ incpatch .Version }}-next"
|
||||
|
||||
+27
-5
@@ -13,10 +13,10 @@ import (
|
||||
|
||||
"github.com/urfave/cli/v2"
|
||||
|
||||
serverlogger "github.com/livekit/livekit-server/pkg/logger"
|
||||
"github.com/livekit/protocol/logger"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/config"
|
||||
serverlogger "github.com/livekit/livekit-server/pkg/logger"
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
"github.com/livekit/livekit-server/pkg/service"
|
||||
"github.com/livekit/livekit-server/version"
|
||||
@@ -92,7 +92,7 @@ func main() {
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "dev",
|
||||
Usage: "sets log-level to debug, console formatter, and /debug/pprof",
|
||||
Usage: "sets log-level to debug, console formatter, and /debug/pprof. insecure for production.",
|
||||
},
|
||||
},
|
||||
Action: startServer,
|
||||
@@ -149,7 +149,31 @@ func getConfig(c *cli.Context) (*config.Config, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return config.NewConfig(confString, c)
|
||||
conf, err := config.NewConfig(confString, c)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
serverlogger.InitFromConfig(conf.Logging)
|
||||
|
||||
if c.String("config") == "" && c.String("config-body") == "" {
|
||||
// without config, use single port UDP
|
||||
conf.Development = true
|
||||
conf.RTC.UDPPort = 7882
|
||||
conf.RTC.ICEPortRangeStart = 0
|
||||
conf.RTC.ICEPortRangeEnd = 0
|
||||
logger.Infow("starting in development mode")
|
||||
|
||||
if len(conf.Keys) == 0 {
|
||||
logger.Infow("no keys provided, using placeholder keys",
|
||||
"API Key", "devkey",
|
||||
"API Secret", "secret",
|
||||
)
|
||||
conf.Keys = map[string]string{
|
||||
"devkey": "secret",
|
||||
}
|
||||
}
|
||||
}
|
||||
return conf, nil
|
||||
}
|
||||
|
||||
func startServer(c *cli.Context) error {
|
||||
@@ -162,8 +186,6 @@ func startServer(c *cli.Context) error {
|
||||
return err
|
||||
}
|
||||
|
||||
serverlogger.InitFromConfig(conf.Logging)
|
||||
|
||||
if memProfile != "" {
|
||||
if f, err := os.Create(memProfile); err != nil {
|
||||
return err
|
||||
|
||||
@@ -214,9 +214,7 @@ func (s *StreamTracker) BitrateTemporalCumulative() []int64 {
|
||||
|
||||
// copy and process
|
||||
brs := make([]int64, len(s.bitrate))
|
||||
for i := 0; i < len(s.bitrate); i++ {
|
||||
brs[i] = s.bitrate[i]
|
||||
}
|
||||
copy(brs, s.bitrate[:])
|
||||
|
||||
for i := len(brs) - 1; i >= 1; i-- {
|
||||
if brs[i] != 0 {
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
//go:build !linux
|
||||
// +build !linux
|
||||
|
||||
package prometheus
|
||||
|
||||
|
||||
Reference in New Issue
Block a user