Skip to content

Commit

Permalink
Switch Windows build to portable workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Shadowghost committed Nov 10, 2022
1 parent 29f816f commit 3b65d4b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 29 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/_meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,8 @@ jobs:
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/[email protected]
with:
Expand Down Expand Up @@ -92,7 +87,7 @@ jobs:
- 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
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/_meta_portable.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,37 +55,59 @@ jobs:
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 Release Directory Exists
- 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/
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/
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 }}
5 changes: 2 additions & 3 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,9 @@ jobs:
release: false

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

Expand Down
63 changes: 46 additions & 17 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,10 @@ 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:
Expand All @@ -59,7 +58,6 @@ jobs:
needs:
- build_publish_debian
- build_publish_ubuntu
- build_publish_windows
strategy:
fail-fast: true
max-parallel: 1
Expand All @@ -71,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 @@ -88,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/server/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/stable/ffmpeg
ln -fs /srv/repository/releases/server/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/stable-pre/ffmpeg
ln -fs /srv/repository/releases/server/${version} /srv/repository/releases/server/${{ matrix.arrays.distro }}/unstable/ffmpeg
File renamed without changes.

0 comments on commit 3b65d4b

Please sign in to comment.