Files
jellyfin-ffmpeg/.github/workflows/_meta.yaml
T

125 lines
4.9 KiB
YAML

on:
workflow_call:
inputs:
distro:
required: true
default: 'debian'
type: string
codenames:
description: 'Stringified JSON object listing target distro codenames'
required: true
default: '["bullseye"]'
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 FFmpeg'
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
release: ${{fromJson(inputs.codenames)}}
arch: ${{fromJson(inputs.architectures)}}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Install make and mmv
run: sudo apt-get install make mmv
- name: Build Linux
run: ./build ${{ matrix.release }} ${{ matrix.arch }} dist
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ inputs.distro }}-${{ matrix.release }}-${{ matrix.arch }}
path: dist
publish:
name: Publish Release
if: ${{ inputs.release }}
runs-on: ubuntu-latest
needs:
- build
strategy:
fail-fast: true
matrix:
release: ${{fromJson(inputs.codenames)}}
arch: ${{fromJson(inputs.architectures)}}
steps:
- name: Set Versions
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
id: set_version
with:
script: |
const tag = context.ref.substring(10)
const no_v = tag.replace('v', '')
const dash_index = no_v.lastIndexOf('-')
const major_index = no_v.indexOf('.')
const no_dash = (dash_index > -1) ? no_v.substring(0, dash_index) : no_v
const major = (major_index > -1) ? no_v.substring(0, major_index) : no_v
core.setOutput('tag', tag)
core.setOutput('no-v', no_v)
core.setOutput('no-dash', no_dash)
core.setOutput('major', major)
- name: Download Artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: ${{ inputs.distro }}-${{ matrix.release }}-${{ matrix.arch }}
path: artifact
- name: Upload GH Release Assets
uses: shogo82148/actions-upload-release-asset@394b3c11c3cfc038b5396ad265c074065cf875c3 # v1.10.2
with:
upload_url: ${{ github.event.release.upload_url }}
overwrite: true
asset_path: |
./artifact/**/*.zip
./artifact/**/*.deb
- name: Upload release archive to repo.jellyfin.org
uses: appleboy/scp-action@ff85246acaad7bdce478db94a363cd2bf7c90345 # v1.0.0
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
key: ${{ secrets.deploy-key }}
source: artifact/*
strip_components: 1
target: /srv/incoming/ffmpeg/${{ steps.set_version.outputs.no-v }}/${{ inputs.distro }}/${{ matrix.arch }}/${{ matrix.release }}
- name: Move incoming release into repository
uses: appleboy/ssh-action@0ff4204d59e8e51228ff73bce53f80d53301dee2 # v1.2.5
with:
host: ${{ secrets.deploy-host }}
username: ${{ secrets.deploy-user }}
key: ${{ secrets.deploy-key }}
envs: JELLYFIN_VERSION
script_stop: true
script: |
# Create the target folder and move arch directory into it
sudo mkdir -p /srv/repository/main/ffmpeg/${{ inputs.distro }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}/${{ matrix.arch }}
sudo mv -t /srv/repository/main/ffmpeg/${{ inputs.distro }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}/${{ matrix.arch }}/ /srv/incoming/ffmpeg/${{ steps.set_version.outputs.no-v }}/${{ inputs.distro }}/${{ matrix.arch }}/${{ matrix.release }}/*
sudo chown -R root:root /srv/repository/main/ffmpeg/${{ inputs.distro }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}/${{ matrix.arch }}
# Update symlink for latest-X.x
sudo rm -f /srv/repository/main/ffmpeg/${{ inputs.distro }}/latest-${{ steps.set_version.outputs.major }}.x || true
sudo ln -s /srv/repository/main/ffmpeg/${{ inputs.distro }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }} /srv/repository/main/ffmpeg/${{ inputs.distro }}/latest-${{ steps.set_version.outputs.major }}.x || true