Skip to content

Commit

Permalink
Merge pull request #249 from binbat/test
Browse files Browse the repository at this point in the history
use nfpm build package deb
  • Loading branch information
a-wing authored Nov 11, 2024
2 parents db2184b + 25548d5 commit a5e0b13
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 86 deletions.
108 changes: 67 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,22 @@ jobs:
matrix:
job:
# https://doc.rust-lang.org/nightly/rustc/platform-support.html
- { target: aarch64-apple-darwin , os: macos-13 }
- { target: aarch64-apple-darwin , os: macos-14 }
- { target: aarch64-pc-windows-msvc , os: windows-2022 }
- { target: aarch64-linux-android , os: ubuntu-22.04, use-cross: true }
- { target: aarch64-unknown-linux-gnu , os: ubuntu-22.04, use-cross: true }
- { target: aarch64-unknown-linux-musl , os: ubuntu-22.04, use-cross: true }
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-22.04, use-cross: true }
- { target: arm-unknown-linux-musleabihf, os: ubuntu-22.04, use-cross: true }
- { target: aarch64-linux-android , os: ubuntu-24.04, use-cross: true }
- { target: aarch64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
- { target: aarch64-unknown-linux-musl , os: ubuntu-24.04, use-cross: true, nfpm: arm64 }
- { target: arm-unknown-linux-gnueabihf , os: ubuntu-24.04, use-cross: true }
- { target: arm-unknown-linux-musleabihf, os: ubuntu-24.04, use-cross: true }
- { target: i686-pc-windows-msvc , os: windows-2022 }
- { target: i686-unknown-linux-gnu , os: ubuntu-22.04, use-cross: true }
- { target: i686-unknown-linux-musl , os: ubuntu-22.04, use-cross: true }
- { target: x86_64-apple-darwin , os: macos-13 }
- { target: i686-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
- { target: i686-unknown-linux-musl , os: ubuntu-24.04, use-cross: true }
- { target: x86_64-apple-darwin , os: macos-14 }
- { target: x86_64-pc-windows-gnu , os: windows-2022 }
- { target: x86_64-pc-windows-msvc , os: windows-2022 }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-22.04, use-cross: true }
- { target: x86_64-unknown-linux-musl , os: ubuntu-22.04, use-cross: true }
- { target: x86_64-unknown-linux-gnu , os: ubuntu-24.04, use-cross: true }
- { target: x86_64-unknown-linux-musl , os: ubuntu-24.04, use-cross: true, nfpm: amd64 }
env:
VERSION: $GITHUB_REF_NAME
BUILD_CMD: cargo
EXE_SUFFIX: ""
PKG_LIVE777_NAME: ""
Expand All @@ -55,8 +54,14 @@ jobs:
run: npm run build

- name: Get the release version from the tag
shell: bash
run: |
echo "version is: ${{ env.VERSION }}"
VERSION=${GITHUB_REF_NAME}
if expr "${VERSION}" : '[^0-9]*$' > /dev/null; then
VERSION=v0.0.0
fi
echo "VERSION=${VERSION}" >> $GITHUB_ENV
echo "version is: ${VERSION}"
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
Expand Down Expand Up @@ -147,35 +152,37 @@ jobs:
# Let subsequent steps know where to find the compressed package
echo "TAR_LIVEMAN_NAME=${TAR_NAME}" >> $GITHUB_ENV
- name: Artifact Upload Live777
uses: actions/upload-artifact@v4
with:
name: ${{ env.TAR_LIVE777_NAME }}
path: ${{ env.TAR_LIVE777_NAME }}

- name: Artifact Upload LiveMan
uses: actions/upload-artifact@v4
with:
name: ${{ env.TAR_LIVEMAN_NAME }}
path: ${{ env.TAR_LIVEMAN_NAME }}

- name: Artifact Upload Whepfrom
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_WHEPFROM_NAME }}
path: ${{ env.BUILD_PATH }}/whepfrom${{ env.EXE_SUFFIX }}
- name: Install nFPM
if: ${{ matrix.job.nfpm }}
run: |
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | sudo tee /etc/apt/sources.list.d/goreleaser.list
sudo apt update
sudo apt install nfpm
- name: Artifact Upload Whipinto
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_WHIPINTO_NAME }}
path: ${{ env.BUILD_PATH }}/whipinto${{ env.EXE_SUFFIX }}
- name: Set nFPM environment
if: ${{ matrix.job.nfpm }}
run: |
echo "NFPM_ARCH=${{ matrix.job.nfpm }}" >> $GITHUB_ENV
echo "NFPM_TARGET=${{ matrix.job.target }}" >> $GITHUB_ENV
echo "NFPM_VERSION=${{ env.VERSION }}" >> $GITHUB_ENV
- name: Artifact Upload Net4mqtt
uses: actions/upload-artifact@v4
with:
name: ${{ env.PKG_NET4MQTT_NAME }}
path: ${{ env.BUILD_PATH }}/net4mqtt${{ env.EXE_SUFFIX }}
- name: Build nFPM config
if: ${{ matrix.job.nfpm }}
run: |
envsubst < nfpm/live777.yaml > live777.yaml
envsubst < nfpm/liveman.yaml > liveman.yaml
envsubst < nfpm/net4mqtt.yaml > net4mqtt.yaml
envsubst < nfpm/whipinto.yaml > whipinto.yaml
envsubst < nfpm/whepfrom.yaml > whepfrom.yaml
- name: Use nFPM
if: ${{ matrix.job.nfpm }}
run: |
nfpm pkg --packager deb --config live777.yaml
nfpm pkg --packager deb --config liveman.yaml
nfpm pkg --packager deb --config net4mqtt.yaml
nfpm pkg --packager deb --config whipinto.yaml
nfpm pkg --packager deb --config whepfrom.yaml
- name: Rename binary
shell: bash
Expand All @@ -184,10 +191,29 @@ jobs:
mv ${{ env.BUILD_PATH }}/whipinto${{ env.EXE_SUFFIX }} ${{ env.PKG_WHIPINTO_NAME }}
mv ${{ env.BUILD_PATH }}/net4mqtt${{ env.EXE_SUFFIX }} ${{ env.PKG_NET4MQTT_NAME }}
- name: Artifact Upload Binary
uses: actions/upload-artifact@v4
with:
name: ${{ env.VERSION }}_${{ matrix.job.target }}_binary
path: |
${{ env.TAR_LIVE777_NAME }}
${{ env.TAR_LIVEMAN_NAME }}
${{ env.PKG_WHEPFROM_NAME }}
${{ env.PKG_WHIPINTO_NAME }}
${{ env.PKG_NET4MQTT_NAME }}
- name: Artifact Upload debian
uses: actions/upload-artifact@v4
if: ${{ matrix.job.nfpm }}
with:
name: ${{ env.VERSION }}_${{ matrix.job.target }}_debian
path: |
*.deb
- name: Upload release archive
shell: bash
if: github.ref_type == 'tag'
run: gh release upload ${{ env.VERSION }} ${{ env.TAR_LIVE777_NAME }} ${{ env.TAR_LIVEMAN_NAME }} ${{ env.PKG_WHEPFROM_NAME }} ${{ env.PKG_WHIPINTO_NAME }} ${{ env.PKG_NET4MQTT_NAME }}
run: gh release upload ${{ env.VERSION }} ${{ env.TAR_LIVE777_NAME }} ${{ env.TAR_LIVEMAN_NAME }} ${{ env.PKG_WHEPFROM_NAME }} ${{ env.PKG_WHIPINTO_NAME }} ${{ env.PKG_NET4MQTT_NAME }} *.deb
env:
GH_TOKEN: ${{ github.token }}

45 changes: 0 additions & 45 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,48 +96,3 @@ tracing-subscriber = { version = "0.3", features = ["env-filter"] }
webui = ["liveion/webui", "liveman/webui"]
net4mqtt = ["liveion/net4mqtt", "liveman/net4mqtt"]

# cargo install cargo-deb
# Reference: https://github.com/kornelski/cargo-deb
[package.metadata.deb]
maintainer = "Metal A-Wing <[email protected]>"
copyright = "BinBat LTD <[email protected]>"
license-file = ["LICENSE"]
extended-description = """\
A very simple, high performance, edge WebRTC SFU.\
Real-time video streaming for the `WHIP`/`WHEP` as first protocol.\
"""
depends = "libc6 systemd"
section = "utility"
priority = "optional"
assets = [
[
"target/release/live777",
"usr/bin/",
"755",
],
[
"target/release/whipinto",
"usr/bin/",
"755",
],
[
"target/release/whepfrom",
"usr/bin/",
"755",
],
[
"config-dist.toml",
"etc/live777/config.toml",
"644",
],
[
"live777.service",
"usr/lib/systemd/system/live777.service",
"644",
],
[
"README.md",
"usr/share/doc/live777/README",
"644",
],
]
22 changes: 22 additions & 0 deletions nfpm/live777.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "live777"
arch: "${NFPM_ARCH}"
platform: "linux"
version: "${NFPM_VERSION}"
section: "utility"
priority: "optional"
maintainer: "Max A-wing <[email protected]>"
description: |
A very simple, high performance, edge WebRTC SFU.
Real-time video streaming for the `WHIP`/`WHEP` as first protocol.
vendor: "BinBat"
homepage: "http://live777.binbat.com"
license: "MPL-2.0"
contents:
- src: ./target/${NFPM_TARGET}/release/live777
dst: /usr/bin/live777
- src: ./conf/live777.service
dst: /usr/lib/systemd/system/live777.service
- src: ./conf/live777.toml
dst: /etc/live777/live777.toml
type: config

22 changes: 22 additions & 0 deletions nfpm/liveman.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: "liveman"
arch: "${NFPM_ARCH}"
platform: "linux"
version: "${NFPM_VERSION}"
section: "utility"
priority: "optional"
maintainer: "Max A-wing <[email protected]>"
description: |
A very simple, high performance, edge WebRTC SFU.
Live777 cluster manager controller
vendor: "BinBat"
homepage: "http://live777.binbat.com"
license: "MPL-2.0"
contents:
- src: ./target/${NFPM_TARGET}/release/liveman
dst: /usr/bin/liveman
- src: ./conf/liveman.service
dst: /usr/lib/systemd/system/liveman.service
- src: ./conf/liveman.toml
dst: /etc/live777/liveman.toml
type: config

17 changes: 17 additions & 0 deletions nfpm/net4mqtt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "net4mqtt"
arch: "${NFPM_ARCH}"
platform: "linux"
version: "${NFPM_VERSION}"
section: "utility"
priority: "optional"
maintainer: "Max A-wing <[email protected]>"
description: |
A very simple, high performance, edge WebRTC SFU.
RTP/RTSP to WHIP tool
vendor: "BinBat"
homepage: "http://live777.binbat.com"
license: "MPL-2.0"
contents:
- src: ./target/${NFPM_TARGET}/release/net4mqtt
dst: /usr/bin/net4mqtt

17 changes: 17 additions & 0 deletions nfpm/whepfrom.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "whepfrom"
arch: "${NFPM_ARCH}"
platform: "linux"
version: "${NFPM_VERSION}"
section: "utility"
priority: "optional"
maintainer: "Max A-wing <[email protected]>"
description: |
A very simple, high performance, edge WebRTC SFU.
WHEP to RTP/RTSP tool
vendor: "BinBat"
homepage: "http://live777.binbat.com"
license: "MPL-2.0"
contents:
- src: ./target/${NFPM_TARGET}/release/whepfrom
dst: /usr/bin/whepfrom

17 changes: 17 additions & 0 deletions nfpm/whipinto.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "whipinto"
arch: "${NFPM_ARCH}"
platform: "linux"
version: "${NFPM_VERSION}"
section: "utility"
priority: "optional"
maintainer: "Max A-wing <[email protected]>"
description: |
A very simple, high performance, edge WebRTC SFU.
RTP/RTSP to WHIP tool
vendor: "BinBat"
homepage: "http://live777.binbat.com"
license: "MPL-2.0"
contents:
- src: ./target/${NFPM_TARGET}/release/whipinto
dst: /usr/bin/whipinto

0 comments on commit a5e0b13

Please sign in to comment.