Files
jellyfin-packaging/.github/workflows/release-build-windows-test.yaml
2025-02-17 02:16:52 -05:00

223 lines
8.7 KiB
YAML

name: "Release Build Windows Test"
on:
schedule:
# Weekly unstable trigger on Monday at 05:00 GMT
- cron: '0 5 * * 1'
workflow_dispatch:
# Manual trigger from bot
inputs:
version:
required: true
type: string
description: 'The server and web stable release tag ("vX.Y.Z") or "master"'
permissions:
contents: read
jobs:
Windows:
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
arch:
- amd64
- arm64
continue-on-error: false # true in prod, false for testing
steps:
- name: "Set dated version for unstable builds"
id: version
run: |-
if grep --silent --extended-regexp '^v[0-9]+' <<< "${{ inputs.version || 'master' }}"; then
echo "JELLYFIN_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
echo "JELLYFIN_RELEASE_TYPE=stable" >> $GITHUB_ENV
else
echo "JELLYFIN_VERSION=$(date +'%Y%m%d%H')" >> $GITHUB_ENV
echo "JELLYFIN_RELEASE_TYPE=unstable" >> $GITHUB_ENV
fi
- name: "Install dependencies"
run: |-
sudo apt-get update
sudo apt-get install --yes python3-git python3-yaml
- name: "Checkout repository"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Prepare repository"
run: |-
./checkout.py ${{ inputs.version || 'master' }}
- name: "Run builder for ${{ matrix.arch }}"
run: |-
sudo --preserve-env ./build.py ${{ env.JELLYFIN_VERSION }} windows ${{ matrix.arch }}
# - name: "Upload artifacts to repository server"
# uses: appleboy/scp-action@917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 # v0.1.7
# with:
# host: "${{ secrets.REPO_HOST }}"
# username: "${{ secrets.REPO_USER }}"
# key: "${{ secrets.REPO_KEY }}"
# source: "out/windows/*"
# strip_components: 2
# target: "/srv/incoming/server/${{ env.JELLYFIN_VERSION }}/windows/${{ matrix.arch }}"
#
# - name: "Move artifacts into repository"
# uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
# with:
# host: "${{ secrets.REPO_HOST }}"
# username: "${{ secrets.REPO_USER }}"
# key: "${{ secrets.REPO_KEY }}"
# debug: false
# script_stop: true
# script: |
# export BASEDIR="/srv/repository/main/server/windows"
# sudo mkdir -p ${BASEDIR}/${{ env.JELLYFIN_RELEASE_TYPE }}/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }} || exit 1
# sudo mv -t ${BASEDIR}/${{ env.JELLYFIN_RELEASE_TYPE }}/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }}/ /srv/incoming/server/${{ env.JELLYFIN_VERSION }}/windows/${{ matrix.release }}/${{ matrix.arch }}/* || exit 1
# sudo rm ${BASEDIR}/latest-${{ env.JELLYFIN_RELEASE_TYPE }} || true
# sudo ln -sf ${BASEDIR}/${{ env.JELLYFIN_RELEASE_TYPE }}/${{ env.JELLYFIN_VERSION }} ${BASEDIR}/latest-${{ env.JELLYFIN_RELEASE_TYPE }} || exit 1
# if [[ ${{ env.JELLYFIN_RELEASE_TYPE }} == "stable" ]]; then
# sudo rm ${BASEDIR}/latest || true
# sudo ln -sf ${BASEDIR}/${{ env.JELLYFIN_RELEASE_TYPE }}/${{ env.JELLYFIN_VERSION }} ${BASEDIR}/latest || exit 1
# fi
- name: "Store artifact for next stage"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: windows-x64
retention-days: 1
if-no-files-found: ignore # Ignore for arm64 build, as no file will be found
path: out/windows/jellyfin_*-amd64.zip
WindowsInstaller:
needs: Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
arch:
- amd64
continue-on-error: false # true in prod, false for testing
env:
DOTNET_CLI_TELEMETRY_OPTOUT: 1
steps:
- name: "Set dated version for unstable builds"
id: version
shell: pwsh
run: |
$version = "${{ inputs.version || 'master' }}"
if ($version -match "^v[0-9]+") {
$cleanVersion = $version.Substring(1) # Remove the leading 'v'
} else {
$cleanVersion = Get-Date -Format "yyyyMMddHH" # Fallback to timestamp
}
echo "JELLYFIN_VERSION=$cleanVersion" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: "Checkout repository"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: "Prepare repository"
run: |-
python checkout.py ${{ inputs.version || 'master' }}
- name: "Fetch artifact from previous stage"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: windows-x64
path: ./jellyfin-server-windows
- name: "Clone UX repository"
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
repository: jellyfin/jellyfin-ux
path: .\jellyfin-server-windows\jellyfin-ux
- name: "Extract Jellyfin server archive"
working-directory: ./jellyfin-server-windows
run: |
Expand-Archive 'jellyfin_*-amd64.zip'
Copy-Item ".\nssm\nssm.exe" -Destination $(Resolve-Path .\jellyfin\jellyfin)
- name: "Add NSSM"
working-directory: ./jellyfin-server-windows
run: |
Invoke-WebRequest 'https://repo.jellyfin.org/files/other/nssm.zip' -OutFile 'nssm.zip'
Expand-Archive 'nssm.zip'
Copy-Item ".\nssm\nssm.exe" -Destination $(Resolve-Path .\jellyfin\jellyfin)
- name: "Publish tray"
working-directory: ./jellyfin-server-windows
run: |
New-Item -Path .\jellyfin\jellyfin\jellyfin-windows-tray -ItemType Directory
dotnet publish -c Release -r win-x64 -f net472 --no-self-contained --output $(Resolve-Path .\jellyfin\jellyfin\jellyfin-windows-tray)
- name: "Build installer"
working-directory: ./jellyfin-server-windows
run: |
$env:InstallLocation = $(Resolve-Path .\jellyfin\jellyfin)
makensis /Dx64 /DUXPATH=$(Resolve-Path .\jellyfin-ux) $(Join-Path -Path $(Resolve-Path .\nsis) -ChildPath jellyfin.nsi)
- name: "Rename installer"
working-directory: ./jellyfin-server-windows/nsis
run: |
Rename-Item -Path .\jellyfin_*_windows-x64.exe -NewName ("jellyfin_${{ env.JELLYFIN_VERSION }}_windows-x64.exe")
- name: "Store artifact for next stage"
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: windows-installer-x64
retention-days: 1
if-no-files-found: error
path: jellyfin-server-windows\nsis\jellyfin_*_windows-x64.exe
WindowsInstallerUpload:
needs: WindowsInstaller
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
arch:
- amd64
continue-on-error: false # true in prod, false for testing
steps:
- name: "Set dated version for unstable builds"
id: version
run: |-
if grep --silent --extended-regexp '^v[0-9]+' <<< "${{ inputs.version || 'master' }}"; then
echo "JELLYFIN_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
echo "JELLYFIN_RELEASE_TYPE=stable" >> $GITHUB_ENV
else
echo "JELLYFIN_VERSION=$(date +'%Y%m%d%H')" >> $GITHUB_ENV
echo "JELLYFIN_RELEASE_TYPE=unstable" >> $GITHUB_ENV
fi
- name: "Fetch artifact from previous stage"
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4
with:
name: windows-installer-x64
- name: "Upload artifacts to repository server"
uses: appleboy/scp-action@917f8b81dfc1ccd331fef9e2d61bdc6c8be94634 # v0.1.7
with:
host: "${{ secrets.REPO_HOST }}"
username: "${{ secrets.REPO_USER }}"
key: "${{ secrets.REPO_KEY }}"
source: "jellyfin_*_windows-x64.exe"
strip_components: 1
target: "/srv/incoming/server/${{ env.JELLYFIN_VERSION }}/windows/${{ matrix.arch }}"
- name: "Move artifacts into repository"
uses: appleboy/ssh-action@7eaf76671a0d7eec5d98ee897acda4f968735a17 # v1.2.0
with:
host: "${{ secrets.REPO_HOST }}"
username: "${{ secrets.REPO_USER }}"
key: "${{ secrets.REPO_KEY }}"
debug: false
script_stop: true
script: |
export BASEDIR="/srv/repository/main/server/windows"
sudo mv -t ${BASEDIR}/${{ env.JELLYFIN_RELEASE_TYPE }}/${{ env.JELLYFIN_VERSION }}/${{ matrix.arch }}/ /srv/incoming/server/${{ env.JELLYFIN_VERSION }}/windows/${{ matrix.arch }}/jellyfin_*.exe || exit 1