Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add portable Linux builds #200

Merged
merged 5 commits into from
Nov 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>jellyfin/.github//renovate-presets/default"
]
}
21 changes: 8 additions & 13 deletions .github/workflows/_meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,16 @@ jobs:
arch: ${{fromJson(inputs.architectures)}}

steps:
- uses: actions/checkout@v2.4.0
- uses: actions/checkout@v3.1.0

- name: Install make and mmv
run: sudo apt-get install make mmv

- name: Build Linux
if: ${{ contains(inputs.distro, 'debian') || contains(inputs.distro, 'ubuntu') }}
run: ./build ${{ matrix.release }} ${{ matrix.arch }} dist

- name: Build Windows
if: ${{ contains(inputs.distro, 'windows') }}
run: ./build-win64 dist

- name: Upload Artifacts
uses: actions/upload-artifact@v3.0.0
uses: actions/upload-artifact@v3.1.1
with:
name: ${{ inputs.distro }}-${{ matrix.release }}-${{ matrix.arch }}
path: dist
Expand All @@ -71,7 +66,7 @@ jobs:

steps:
- name: Set Versions
uses: actions/github-script@v6.0.0
uses: actions/github-script@v6.3.3
id: set_version
with:
script: |
Expand All @@ -84,21 +79,21 @@ jobs:
core.setOutput('no-dash', no_dash)

- name: Download Artifacts
uses: actions/[email protected].0
uses: actions/[email protected].1
with:
name: ${{ inputs.distro }}-${{ matrix.release }}-${{ matrix.arch }}
path: artifact

- name: Prepare Release Assets
run: |-
pushd artifact
find * -type f \( -name "*.deb" -o -name "*.zip" \) | while read file; do
find * -type f -name "*.deb" | while read file; do
sha256sum "${file}" | tee "${file}.sha256sum"
done
popd

- name: Upload GH Release Assets
uses: shogo82148/actions-upload-release-asset@v1.5.0
uses: shogo82148/actions-upload-release-asset@v1.6.3
with:
upload_url: ${{ github.event.release.upload_url }}
overwrite: true
Expand All @@ -108,7 +103,7 @@ jobs:
./artifact/**/*.sha256sum

- name: Make Sure Release Directory Exists
uses: appleboy/[email protected].4
uses: appleboy/[email protected].5
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
Expand All @@ -118,7 +113,7 @@ jobs:
mkdir -p /srv/repository/releases/server/${{ inputs.distro }}/versions/jellyfin-ffmpeg/${{ steps.set_version.outputs.no-v }}/

- name: Upload Release Assets
uses: burnett01/[email protected]
uses: burnett01/[email protected].1
with:
switches: -vrptz
path: ./artifact/*
Expand Down
113 changes: 113 additions & 0 deletions .github/workflows/_meta_portable.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
on:
workflow_call:
inputs:
os:
required: true
default: 'linux'
type: string
architectures:
description: 'Stringified JSON object listing target architectures'
required: true
default: '["amd64"]'
type: string
release:
required: false
default: false
type: boolean
secrets:
deploy-host:
required: false
deploy-user:
required: false
deploy-key:
required: false

jobs:
build:
name: 'Build Portable FFmpeg'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
arch: ${{fromJson(inputs.architectures)}}

steps:
- uses: actions/[email protected]

- name: Build Portable
run: ./build-${{ inputs.os }}-${{ matrix.arch }} ./dist

- name: Upload Artifacts
uses: actions/[email protected]
with:
name: ${{ inputs.os }}-${{ matrix.arch }}-portable
path: dist

publish:
name: Publish Portable Release
if: ${{ inputs.release }}
runs-on: ubuntu-latest
needs:
- build
strategy:
fail-fast: true
matrix:
arch: ${{fromJson(inputs.architectures)}}

steps:
- name: Set Versions
uses: actions/[email protected]
id: set_version
with:
script: |
const tag = context.ref.substring(10)
const no_v = tag.replace('v', '')
const dash_index = no_v.lastIndexOf('-')
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
core.setOutput('tag', tag)
core.setOutput('no-v', no_v)
core.setOutput('no-dash', no_dash)

- name: Download Artifacts
uses: actions/[email protected]
with:
name: ${{ inputs.os }}-${{ matrix.arch }}-portable
path: artifact

- name: Prepare Release Assets
run: |-
pushd artifact
find * -type f \( -name "*.xz" -o -name "*.zip" \) | while read file; do
sha256sum "${file}" | tee "${file}.sha256sum"
done
popd

- name: Upload GH Release Assets
uses: shogo82148/[email protected]
with:
upload_url: ${{ github.event.release.upload_url }}
overwrite: true
asset_path: |
./artifact/**/*.zip
./artifact/**/*.tar.xz
./artifact/**/*.sha256sum

- name: Make Sure FFmpeg Directory Exists
uses: appleboy/[email protected]
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
key: ${{ secrets.deploy-key }}
script_stop: true
script: |-
mkdir -p /srv/repository/releases/ffmpeg/${{ steps.set_version.outputs.no-v }}/

- name: Upload Release Assets
uses: burnett01/[email protected]
with:
switches: -vrptz
path: ./artifact/*
remote_path: /srv/repository/releases/ffmpeg/${{ steps.set_version.outputs.no-v }}/
remote_host: ${{ secrets.deploy-host }}
remote_user: ${{ secrets.deploy-user }}
remote_key: ${{ secrets.deploy-key }}
14 changes: 10 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ jobs:
architectures: '["amd64", "arm64", "armhf"]'
release: false

build_windows:
uses: ./.github/workflows/_meta.yaml
build_portable_windows:
uses: ./.github/workflows/_meta_portable.yaml
with:
distro: 'windows'
codenames: '["windows"]'
os: 'windows'
architectures: '["win64"]'
release: false

build_portable_linux:
uses: ./.github/workflows/_meta_portable.yaml
with:
os: 'linux'
architectures: '["amd64", "arm64"]'
release: false
74 changes: 57 additions & 17 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,34 @@ jobs:
deploy-user: ${{ secrets.DEPLOY_USER }}
deploy-key: ${{ secrets.DEPLOY_KEY }}

build_publish_windows:
uses: ./.github/workflows/_meta.yaml
build_publish_windows_portable:
uses: ./.github/workflows/_meta_portable.yaml
with:
distro: 'windows'
codenames: '["windows"]'
os: 'windows'
architectures: '["win64"]'
release: true
secrets:
deploy-host: ${{ secrets.DEPLOY_HOST }}
deploy-user: ${{ secrets.DEPLOY_USER }}
deploy-key: ${{ secrets.DEPLOY_KEY }}

build_publish_linux_portable:
uses: ./.github/workflows/_meta_portable.yaml
with:
os: 'linux'
architectures: '["amd64", "arm64"]'
release: true
secrets:
deploy-host: ${{ secrets.DEPLOY_HOST }}
deploy-user: ${{ secrets.DEPLOY_USER }}
deploy-key: ${{ secrets.DEPLOY_KEY }}

maintain_repository:
name: Maintain Repository
runs-on: ubuntu-latest
needs:
- build_publish_debian
- build_publish_ubuntu
- build_publish_windows
strategy:
fail-fast: true
max-parallel: 1
Expand All @@ -60,7 +69,6 @@ jobs:
{distro: 'ubuntu', codename: 'jammy'},
{distro: 'ubuntu', codename: 'focal'},
{distro: 'ubuntu', codename: 'bionic'},
{distro: 'windows', codename: 'windows'},
]
steps:
- name: Sync mirrors and update symlinks
Expand All @@ -77,20 +85,52 @@ jobs:
version="${tag#v}"
basename="jellyfin-ffmpeg*_${version}-${{ matrix.arrays.codename }}"
find /srv/repository/releases/server/${{ matrix.arrays.distro }}/ -type l -name "jellyfin-ffmpeg*_*" -exec rm {} \;
if [ "${{ matrix.arrays.distro }}" != "windows" ]; then
find /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version} -type f -name "${basename}_*.deb" | while read file; do
reprepro -b /srv/repository/${{ matrix.arrays.distro }} --export=never --keepunreferencedfiles includedeb ${{ matrix.arrays.codename }} ${file}
done
find /srv/repository/releases/server/${{ matrix.arrays.distro }}/ -type l -name "${basename}_*" -exec rm {} \;
reprepro -b /srv/repository/${{ matrix.arrays.distro }} deleteunreferenced
reprepro -b /srv/repository/${{ matrix.arrays.distro }} export
fi
if [ "${{ matrix.arrays.distro }}" == "windows" ]; then
ln -fs /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version}/${basename}_*.zip /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version}/jellyfin-ffmpeg.zip
fi
find /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version} -type f -name "${basename}_*.deb" | while read file; do
reprepro -b /srv/repository/${{ matrix.arrays.distro }} --export=never --keepunreferencedfiles includedeb ${{ matrix.arrays.codename }} ${file}
done
find /srv/repository/releases/server/${{ matrix.arrays.distro }}/ -type l -name "${basename}_*" -exec rm {} \;
reprepro -b /srv/repository/${{ matrix.arrays.distro }} deleteunreferenced
reprepro -b /srv/repository/${{ matrix.arrays.distro }} export
rm -f /srv/repository/releases/server/${{ matrix.arrays.distro }}/ffmpeg
rm -f /srv/repository/releases/server/${{ matrix.arrays.distro }}/{stable,stable-pre,unstable}/ffmpeg
ln -fs /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/ffmpeg
ln -fs /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/stable/ffmpeg
ln -fs /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/stable-pre/ffmpeg
ln -fs /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/unstable/ffmpeg

maintain_repository_portable:
name: Maintain Repository
runs-on: ubuntu-latest
needs:
- build_publish_windows_portable
strategy:
fail-fast: true
max-parallel: 1
matrix:
arrays: [
{distro: 'windows', codename: 'windows'},
]
steps:
- name: Update symlinks
uses: appleboy/[email protected]
with:
host: ${{ secrets.DEPLOY_HOST }}
username: ${{ secrets.DEPLOY_USER }}
key: ${{ secrets.DEPLOY_KEY }}
script_stop: true
script: |-
set -o errexit
set -o xtrace
tag="${{ github.event.release.tag_name }}"
version="${tag#v}"
basename="jellyfin-ffmpeg*_${version}-${{ matrix.arrays.codename }}"
find /srv/repository/releases/server/${{ matrix.arrays.distro }}/ -type l -name "jellyfin-ffmpeg*_*" -exec rm {} \;
if [ "${{ matrix.arrays.distro }}" == "windows" ]; then
ln -fs /srv/repository/releases/ffmpeg/${version}/${basename}_*.zip /srv/repository/releases/server/${{ matrix.arrays.distro }}/versions/jellyfin-ffmpeg/${version}/jellyfin-ffmpeg.zip
fi
rm -f /srv/repository/releases/server/${{ matrix.arrays.distro }}/ffmpeg
rm -f /srv/repository/releases/server/${{ matrix.arrays.distro }}/{stable,stable-pre,unstable}/ffmpeg
ln -fs /srv/repository/releases/ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/ffmpeg
ln -fs /srv/repository/releases/ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/stable/ffmpeg
ln -fs /srv/repository/releases/ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/stable-pre/ffmpeg
ln -fs /srv/repository/releases/ffmpeg/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/unstable/ffmpeg
24 changes: 24 additions & 0 deletions build-linux-amd64
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -o xtrace
set -o errexit

# Check for dependencies
for dep in bash docker; do
command -v ${dep} &>/dev/null || { echo "The command '${dep}' is required."; exit 1; }
done

# Build the jellyfin-ffmpeg portable version
[[ $(docker image ls 'ghcr.io/jellyfin/jellyfin-ffmpeg/linux64-gpl:latest' | wc -l) -eq 1 ]] && \
./builder/makeimage.sh linux64 gpl

./builder/build.sh linux64 gpl

# If no 1st parameter was specified, move pkg to parent directory
if [[ -z ${1} ]]; then
path="../bin"
else
path="${1}"
fi
mkdir ${path} &>/dev/null || true
mv builder/artifacts/jellyfin-ffmpeg*portable_linux64-gpl*.{tar.xz,sha256sum} "${path}"
24 changes: 24 additions & 0 deletions build-linux-arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/usr/bin/env bash

set -o xtrace
set -o errexit

# Check for dependencies
for dep in bash docker; do
command -v ${dep} &>/dev/null || { echo "The command '${dep}' is required."; exit 1; }
done

# Build the jellyfin-ffmpeg portable version
[[ $(docker image ls 'ghcr.io/jellyfin/jellyfin-ffmpeg/linuxarm64-gpl:latest' | wc -l) -eq 1 ]] && \
./builder/makeimage.sh linuxarm64 gpl

./builder/build.sh linuxarm64 gpl

# If no 1st parameter was specified, move pkg to parent directory
if [[ -z ${1} ]]; then
path="../bin"
else
path="${1}"
fi
mkdir ${path} &>/dev/null || true
mv builder/artifacts/jellyfin-ffmpeg*portable_linuxarm64-gpl*.{tar.xz,sha256sum} "${path}"
File renamed without changes.
4 changes: 4 additions & 0 deletions builder/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
/Dockerfile
/ffbuild/
/artifacts/
/.cache/
7 changes: 7 additions & 0 deletions builder/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Copyright 2020-2021 BtbN <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Loading