Release #235
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: [master] | |
tags: | |
- "atm0s-media-server-v*.*.*" | |
create: | |
tags: | |
- "atm0s-media-server-v*.*.*" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
APP_NAME: atm0s-media-server | |
ARTIFACT_DIR: release-builds | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
LIBOPUS_STATIC: true | |
LIBSOXR_STATIC: true | |
OPENSSL_STATIC: true | |
jobs: | |
build-console: | |
name: build-frontend | |
runs-on: ubuntu-latest | |
env: | |
NEXT_PUBLIC_API_URL: /api/ | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v4 | |
name: Install pnpm | |
with: | |
version: 8 | |
run_install: false | |
- name: Install Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Build dashboard | |
run: | | |
VERSION=$(cat bin/CONSOLE_FRONTEND) | |
git clone https://github.com/8xFF/atm0s-media-server-console.git | |
cd atm0s-media-server-console | |
git checkout $VERSION | |
pnpm install | |
cd apps/console | |
pnpm build | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: console-frontend | |
path: atm0s-media-server-console/apps/console/out | |
build-release: | |
name: build-release | |
needs: build-console | |
runs-on: ${{ matrix.os }} | |
env: | |
RUST_BACKTRACE: 1 | |
strategy: | |
matrix: | |
build: | |
- linux gnu x64 | |
- linux musl x64 | |
- linux gnu aarch64 | |
- linux musl aarch64 | |
# - linux gnueabihf arm | |
# - linux gnueabihf armv7 | |
# - linux gnu mips | |
# - linux gnuabi64 mips64 | |
# - linux gnuabi64 mips64el | |
# - linux gnu mipsel | |
- macos x64 | |
- macos aarch64 | |
# - windows gnu x64 | |
# - windows msvc x64 | |
include: | |
- build: linux gnu x64 | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-gnu | |
extension: "" | |
cross: false | |
build_record_tool: true | |
build_record_worker: true | |
- build: linux musl x64 | |
os: ubuntu-latest | |
rust: stable | |
target: x86_64-unknown-linux-musl | |
extension: "" | |
cross: false | |
- build: linux gnu aarch64 | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-gnu | |
extension: "" | |
cross: true | |
build_record_tool: true | |
build_record_worker: true | |
- build: linux musl aarch64 | |
os: ubuntu-latest | |
rust: stable | |
target: aarch64-unknown-linux-musl | |
extension: "" | |
cross: true | |
# - build: linux gnueabihf arm | |
# os: ubuntu-latest | |
# rust: stable | |
# target: arm-unknown-linux-gnueabihf | |
# extension: "" | |
# cross: true | |
# - build: linux gnueabihf armv7 | |
# os: ubuntu-latest | |
# rust: stable | |
# target: armv7-unknown-linux-gnueabihf | |
# extension: "" | |
# cross: true | |
# - build: linux gnu mips | |
# os: ubuntu-latest | |
# rust: 1.71.1 | |
# target: mips-unknown-linux-gnu | |
# extension: "" | |
# cross: true | |
# - build: linux gnuabi64 mips64 | |
# os: ubuntu-latest | |
# rust: 1.71.1 | |
# target: mips64-unknown-linux-gnuabi64 | |
# extension: "" | |
# cross: true | |
# - build: linux gnuabi64 mips64el | |
# os: ubuntu-latest | |
# rust: 1.71.1 | |
# target: mips64el-unknown-linux-gnuabi64 | |
# extension: "" | |
# cross: true | |
# - build: linux gnu mipsel | |
# os: ubuntu-latest | |
# rust: 1.71.1 | |
# target: mipsel-unknown-linux-gnu | |
# extension: "" | |
# cross: true | |
# - build: linux musl aarch64 | |
# os: ubuntu-latest | |
# rust: stable | |
# target: aarch64-unknown-linux-musl | |
# extension: "" | |
# cross: true | |
- build: macos x64 | |
os: macos-latest | |
rust: stable | |
target: x86_64-apple-darwin | |
extension: "" | |
cross: false | |
build_record_tool: true | |
build_record_worker: true | |
- build: macos aarch64 | |
os: macos-latest | |
rust: stable | |
target: aarch64-apple-darwin | |
extension: "" | |
cross: true | |
build_record_tool: true | |
build_record_worker: true | |
# - build: windows gnu x64 | |
# os: ubuntu-latest | |
# rust: stable | |
# target: x86_64-pc-windows-gnu | |
# extension: ".exe" | |
# cross: false | |
# - build: windows msvc x64 | |
# os: windows-latest | |
# rust: stable | |
# target: x86_64-pc-windows-msvc | |
# extension: ".exe" | |
# cross: false | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: ${{ matrix.rust }} | |
profile: minimal | |
override: true | |
target: ${{ matrix.target }} | |
- name: Install dev-tools | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get install -y --no-install-recommends pkg-config musl-dev musl-tools | |
sudo ln -s /bin/g++ /bin/musl-g++ | |
- uses: actions/download-artifact@v4 | |
with: | |
name: console-frontend | |
path: bin/public/console | |
- name: Patch some libs | |
run: | | |
mv ./.cargo/config.toml.release-build .cargo/config.toml | |
- name: Build server | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.cross }} | |
command: build | |
args: --verbose --release --package ${{ env.APP_NAME }} --target ${{ matrix.target }} --features embed_static | |
- name: Build record tool | |
if: matrix.build_record_tool | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.cross }} | |
command: build | |
args: --verbose --release --package media-server-record --target ${{ matrix.target }} --bin convert_record_cli | |
- name: Build record worker | |
if: matrix.build_record_worker | |
uses: actions-rs/cargo@v1 | |
with: | |
use-cross: ${{ matrix.cross }} | |
command: build | |
args: --verbose --release --package media-server-record --target ${{ matrix.target }} --bin convert_record_worker | |
- name: Rename server | |
if: ${{ matrix.build != 'windows gnu x64' && matrix.build != 'windows msvc x64' }} | |
run: | | |
mv ./target/${{ matrix.target }}/release/${{ env.APP_NAME }}${{ matrix.extension }} ${{ env.APP_NAME }}-${{ matrix.target }}${{ matrix.extension }} | |
- name: Rename record | |
if: ${{ matrix.build_record_tool && matrix.build != 'windows gnu x64' && matrix.build != 'windows msvc x64' }} | |
run: | | |
mv ./target/${{ matrix.target }}/release/convert_record_cli${{ matrix.extension }} convert_record_cli-${{ matrix.target }}${{ matrix.extension }} | |
- name: Rename record worker | |
if: ${{ matrix.build_record_worker && matrix.build != 'windows gnu x64' && matrix.build != 'windows msvc x64' }} | |
run: | | |
mv ./target/${{ matrix.target }}/release/convert_record_worker${{ matrix.extension }} convert_record_worker-${{ matrix.target }}${{ matrix.extension }} | |
- name: Upload Artifact to Summary | |
if: ${{ matrix.build != 'windows gnu x64' && matrix.build != 'windows msvc x64' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.target }} | |
path: | | |
*-${{ matrix.target }}${{ matrix.extension }} | |
- name: Upload server binary to release | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: ${{ env.APP_NAME }}-${{ matrix.target }}${{ matrix.extension }} | |
asset_name: ${{ env.APP_NAME }}-${{ matrix.target }}${{ matrix.extension }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: Upload convert_record_cli binary to release | |
if: startsWith(github.ref, 'refs/tags/') && matrix.build_record_tool | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: convert_record_cli-${{ matrix.target }}${{ matrix.extension }} | |
asset_name: convert_record_cli-${{ matrix.target }}${{ matrix.extension }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
- name: Upload convert_record_worker binary to release | |
if: startsWith(github.ref, 'refs/tags/') && matrix.build_record_worker | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: convert_record_worker-${{ matrix.target }}${{ matrix.extension }} | |
asset_name: convert_record_worker-${{ matrix.target }}${{ matrix.extension }} | |
tag: ${{ github.ref }} | |
overwrite: true | |
create-release: | |
# only run if not a tags build | |
if: startsWith(github.ref, 'refs/tags/') == false | |
needs: build-release | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: create_release | |
id: create_release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: ${{ github.event_name == 'workflow_dispatch' && 'latest' || (github.ref == 'refs/heads/master' && 'latest') || github.ref }} | |
title: Build ${{ github.event_name == 'workflow_dispatch' && 'development' || github.ref }} | |
files: | | |
*/* | |
prerelease: true | |
deploy-docker: | |
needs: build-release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Download maxminddb | |
run: sh download-geodata.sh | |
- uses: actions/download-artifact@v4 | |
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. | |
- name: Log in to the Container registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. | |
- name: Extract metadata (tags, labels) for Docker | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. | |
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. | |
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. | |
- name: Build and push Docker image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64,linux/arm64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |