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

131 lines
5.0 KiB
YAML

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:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: true
swap-storage: true
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Build Portable
run: ./build-${{ inputs.os }}-${{ matrix.arch }} ./dist
- name: Upload Artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
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/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.os }}-${{ matrix.arch }}-portable
path: artifact
- name: Upload GH Release Assets
uses: shogo82148/actions-upload-release-asset@aaba0f56bdbc1071f4af234d5cb16055e8a400de # v1.10.4
with:
upload_url: ${{ github.event.release.upload_url }}
overwrite: true
asset_path: |
./artifact/**/*.zip
./artifact/**/*.tar.xz
- 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.os }}/${{ matrix.arch }}
- 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.os }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}/${{ matrix.arch }}
sudo mv -t /srv/repository/main/ffmpeg/${{ inputs.os }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}/${{ matrix.arch }}/ /srv/incoming/ffmpeg/${{ steps.set_version.outputs.no-v }}/${{ inputs.os }}/${{ matrix.arch }}/*
sudo chown -R root:root /srv/repository/main/ffmpeg/${{ inputs.os }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }}
# Update symlink for latest-X.x
sudo rm -f /srv/repository/main/ffmpeg/${{ inputs.os }}/latest-${{ steps.set_version.outputs.major }}.x || true
sudo ln -s /srv/repository/main/ffmpeg/${{ inputs.os }}/${{ steps.set_version.outputs.major }}.x/${{ steps.set_version.outputs.no-v }} /srv/repository/main/ffmpeg/${{ inputs.os }}/latest-${{ steps.set_version.outputs.major }}.x || true