mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
344 lines
13 KiB
344 lines
13 KiB
name: Build Artifacts |
|
on: |
|
workflow_call: |
|
inputs: |
|
release_tag: |
|
description: 'Release tag' |
|
required: true |
|
type: string |
|
release_version: |
|
description: 'Release version number (e.g. v0.3.7-alpha)' |
|
required: true |
|
type: string |
|
info_version: |
|
description: 'Informational version number (e.g. 0.3.7-alpha)' |
|
required: true |
|
type: string |
|
secrets: |
|
apple_developer_certificate_p12_base64: |
|
required: true |
|
apple_developer_certificate_password: |
|
required: true |
|
ac_username: |
|
required: true |
|
ac_password: |
|
required: true |
|
gh_token: |
|
required: true |
|
azure_client_id: |
|
required: true |
|
azure_tenant_id: |
|
required: true |
|
azure_subscription_id: |
|
required: true |
|
permissions: |
|
id-token: write |
|
contents: write |
|
jobs: |
|
build_and_upload_mac: |
|
name: Mac Build & Upload |
|
runs-on: ${{ matrix.os }} |
|
strategy: |
|
matrix: |
|
include: |
|
- os: macos-14 |
|
kind: macOS |
|
target: osx-x64 |
|
- os: macos-14 |
|
kind: macOS |
|
target: osx-arm64 |
|
steps: |
|
- name: Get the sources |
|
uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
submodules: true |
|
|
|
- name: Setup dotnet |
|
uses: actions/setup-dotnet@v4 |
|
with: |
|
dotnet-version: '10.0.x' |
|
|
|
- name: Clean |
|
run: dotnet clean --configuration Release && dotnet nuget locals all --clear |
|
|
|
- name: Install dependencies |
|
run: dotnet restore -r "${{ matrix.target}}" |
|
|
|
- name: Import Code-Signing Certificates |
|
uses: Apple-Actions/import-codesign-certs@v2 |
|
with: |
|
p12-file-base64: ${{ secrets.apple_developer_certificate_p12_base64 }} |
|
p12-password: ${{ secrets.apple_developer_certificate_password }} |
|
|
|
- name: Calculate Release Name |
|
shell: bash |
|
run: | |
|
release_name="ErsatzTV-Legacy-${{ inputs.release_version }}-${{ matrix.target }}" |
|
echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV |
|
|
|
- name: Build |
|
shell: bash |
|
run: | |
|
sed -i '' '/Scanner/d' ErsatzTV/ErsatzTV.csproj |
|
dotnet publish ErsatzTV.Scanner/ErsatzTV.Scanner.csproj --framework net10.0 --runtime "${{ matrix.target }}" -c Release -o publish -p:RestoreEnablePackagePruning=true -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:EnableCompressionInSingleFile=false -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true |
|
dotnet publish ErsatzTV/ErsatzTV.csproj --framework net10.0 --runtime "${{ matrix.target }}" -c Release -o publish -p:RestoreEnablePackagePruning=true -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:EnableCompressionInSingleFile=false -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true |
|
|
|
- name: Bundle |
|
shell: bash |
|
run: | |
|
brew install coreutils |
|
plutil -replace CFBundleShortVersionString -string "${{ inputs.info_version }}" ErsatzTV-macOS/ErsatzTV-macOS/Info.plist |
|
plutil -replace CFBundleVersion -string "${{ inputs.info_version }}" ErsatzTV-macOS/ErsatzTV-macOS/Info.plist |
|
scripts/macOS/bundle.sh |
|
|
|
- name: Sign |
|
shell: bash |
|
run: scripts/macOS/sign.sh |
|
|
|
- name: Create DMG |
|
shell: bash |
|
run: | |
|
brew install create-dmg |
|
create-dmg \ |
|
--volname "ErsatzTV-Legacy" \ |
|
--volicon "artwork/ErsatzTV.icns" \ |
|
--window-pos 200 120 \ |
|
--window-size 800 400 \ |
|
--icon-size 100 \ |
|
--icon "ErsatzTV.app" 200 190 \ |
|
--hide-extension "ErsatzTV.app" \ |
|
--app-drop-link 600 185 \ |
|
--skip-jenkins \ |
|
--no-internet-enable \ |
|
"ErsatzTV-Legacy.dmg" \ |
|
"ErsatzTV-Legacy.app/" |
|
|
|
- name: Notarize |
|
shell: bash |
|
run: | |
|
xcrun notarytool submit ErsatzTV-Legacy.dmg --apple-id "${{ secrets.ac_username }}" --password "${{ secrets.ac_password }}" --team-id 32MB98Q32R --wait |
|
xcrun stapler staple ErsatzTV-Legacy.dmg |
|
|
|
- name: Cleanup |
|
shell: bash |
|
run: | |
|
mv ErsatzTV-Legacy.dmg "${{ env.RELEASE_NAME }}.dmg" |
|
rm -r publish |
|
rm -r ErsatzTV-Legacy.app |
|
|
|
- name: Delete old release assets |
|
if: ${{ inputs.release_tag == 'develop' }} |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: | |
|
gh release view ${{ inputs.release_tag }} --json assets --jq '.assets[].name' --repo ${{ github.repository }} \ |
|
| grep '${{ matrix.target }}.dmg' \ |
|
| xargs -r -I{} gh release delete-asset ${{ inputs.release_tag }} {} --yes --repo ${{ github.repository }} |
|
|
|
- name: Publish |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: gh release upload ${{ inputs.release_tag }} "${{ env.RELEASE_NAME }}.dmg" --repo ${{ github.repository }} |
|
|
|
build_and_upload_linux: |
|
name: Build & Upload Linux |
|
runs-on: ${{ matrix.os }} |
|
strategy: |
|
matrix: |
|
include: |
|
- os: ubuntu-latest |
|
kind: linux |
|
target: linux-x64 |
|
- os: ubuntu-latest |
|
kind: linux |
|
target: linux-musl-x64 |
|
- os: ubuntu-latest |
|
kind: linux |
|
target: linux-arm |
|
- os: ubuntu-24.04-arm |
|
kind: linux |
|
target: linux-arm64 |
|
steps: |
|
- name: Get the sources |
|
uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
|
|
- name: Setup dotnet |
|
uses: actions/setup-dotnet@v4 |
|
with: |
|
dotnet-version: '10.0.x' |
|
|
|
- name: Clean |
|
run: dotnet clean --configuration Release && dotnet nuget locals all --clear |
|
|
|
- name: Install dependencies |
|
run: dotnet restore -r "${{ matrix.target }}" |
|
|
|
- name: Build |
|
shell: bash |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: | |
|
# Define some variables for things we need |
|
release_name="ErsatzTV-Legacy-${{ inputs.release_version }}-${{ matrix.target }}" |
|
echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV |
|
|
|
# Build everything |
|
sed -i '/Scanner/d' ErsatzTV/ErsatzTV.csproj |
|
dotnet publish ErsatzTV.Scanner/ErsatzTV.Scanner.csproj --framework net10.0 --runtime "${{ matrix.target }}" -c Release -o "scanner" -p:RestoreEnablePackagePruning=true -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:EnableCompressionInSingleFile=true -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true |
|
dotnet publish ErsatzTV/ErsatzTV.csproj --framework net10.0 --runtime "${{ matrix.target }}" -c Release -o "main" -p:RestoreEnablePackagePruning=true -p:InformationalVersion="${{ inputs.release_version }}-${{ matrix.target }}" -p:EnableCompressionInSingleFile=true -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true |
|
mkdir "$release_name" |
|
mv scanner/* "$release_name/" |
|
mv main/* "$release_name/" |
|
|
|
# download next artifacts |
|
gh release download develop --repo ErsatzTV/next --pattern "ersatztv-next-*-${{ matrix.target }}.tar.gz" --dir next-download |
|
mkdir next-extracted |
|
tar xzvf next-download/*.tar.gz -C next-extracted --strip-components 1 |
|
mv next-extracted/ersatztv-channel "$release_name/" |
|
rm -rf next-download next-extracted |
|
|
|
tar czvf "${release_name}.tar.gz" "$release_name" |
|
|
|
# Delete output directory |
|
rm -r "$release_name" |
|
|
|
- name: Delete old release assets |
|
if: ${{ inputs.release_tag == 'develop' }} |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: | |
|
gh release view ${{ inputs.release_tag }} --json assets --jq '.assets[].name' --repo ${{ github.repository }} \ |
|
| grep '${{ matrix.target }}.tar.gz' \ |
|
| xargs -r -I{} gh release delete-asset ${{ inputs.release_tag }} {} --yes --repo ${{ github.repository }} |
|
|
|
- name: Publish |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: gh release upload ${{ inputs.release_tag }} "${{ env.RELEASE_NAME }}.tar.gz" --repo ${{ github.repository }} |
|
|
|
build_dotnet_windows: |
|
name: Build dotnet for Windows |
|
runs-on: ubuntu-latest |
|
steps: |
|
- name: Get the sources |
|
uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
|
|
- name: Setup dotnet |
|
uses: actions/setup-dotnet@v4 |
|
with: |
|
dotnet-version: '10.0.x' |
|
|
|
- name: Clean |
|
run: dotnet clean --configuration Release && dotnet nuget locals all --clear |
|
|
|
- name: Install dependencies |
|
run: dotnet restore -r "win-x64" |
|
|
|
- name: Build dotnet projects |
|
shell: bash |
|
run: | |
|
sed -i '/Scanner/d' ErsatzTV/ErsatzTV.csproj |
|
dotnet publish ErsatzTV.Scanner/ErsatzTV.Scanner.csproj --framework net10.0 --runtime "win-x64" -c Release -o "scanner" -p:RestoreEnablePackagePruning=true -p:InformationalVersion="${{ inputs.release_version }}-win-x64" -p:EnableCompressionInSingleFile=true -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true |
|
dotnet publish ErsatzTV/ErsatzTV.csproj --framework net10.0 --runtime "win-x64" -c Release -o "main" -p:RestoreEnablePackagePruning=true -p:InformationalVersion="${{ inputs.release_version }}-win-x64" -p:EnableCompressionInSingleFile=true -p:DebugType=Embedded -p:PublishSingleFile=true --self-contained true |
|
|
|
- name: Upload .NET Artifact |
|
uses: actions/upload-artifact@v4 |
|
with: |
|
name: dotnet-windows-build |
|
path: | |
|
scanner/ |
|
main/ |
|
retention-days: 1 |
|
|
|
package_and_upload_windows: |
|
name: Package & Upload Windows |
|
runs-on: windows-latest |
|
needs: build_dotnet_windows |
|
steps: |
|
- name: Download dotnet artifacts |
|
uses: actions/download-artifact@v4 |
|
with: |
|
name: dotnet-windows-build |
|
path: dotnet-build |
|
|
|
- name: Azure login |
|
uses: azure/login@v2 |
|
with: |
|
client-id: ${{ secrets.azure_client_id }} |
|
tenant-id: ${{ secrets.azure_tenant_id }} |
|
subscription-id: ${{ secrets.azure_subscription_id }} |
|
enable-AzPSSession: true |
|
|
|
- name: Sign dotnet artifacts |
|
uses: azure/trusted-signing-action@v0 |
|
with: |
|
endpoint: https://eus.codesigning.azure.net/ |
|
trusted-signing-account-name: ArtifactSigning |
|
certificate-profile-name: ErsatzTV |
|
files-folder: ${{ github.workspace }}/dotnet-build |
|
files-folder-recurse: true |
|
files-folder-filter: ErsatzTV.exe,ErsatzTV.Scanner.exe |
|
file-digest: SHA256 |
|
timestamp-rfc3161: http://timestamp.acs.microsoft.com |
|
timestamp-digest: SHA256 |
|
|
|
- name: Download rust launcher |
|
uses: suisei-cn/actions-download-file@v1.3.0 |
|
with: |
|
url: "https://github.com/ErsatzTV/ErsatzTV-Windows/releases/download/v1.0.0/ErsatzTV-Windows.exe" |
|
target: rust-build/ |
|
|
|
- name: Download ffmpeg |
|
uses: suisei-cn/actions-download-file@v1.3.0 |
|
id: downloadffmpeg |
|
with: |
|
url: "https://github.com/ErsatzTV/ErsatzTV-ffmpeg/releases/download/7.1.1/ffmpeg-n7.1.1-56-gc2184b65d2-win64-gpl-7.1.zip" |
|
target: ffmpeg/ |
|
|
|
- name: Package artifacts |
|
shell: bash |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: | |
|
release_name="ErsatzTV-Legacy-${{ inputs.release_version }}-win-x64" |
|
echo "RELEASE_NAME=${release_name}" >> $GITHUB_ENV |
|
mkdir "$release_name" |
|
|
|
mv dotnet-build/scanner/* "$release_name/" |
|
mv dotnet-build/main/* "$release_name/" |
|
|
|
# dotnet shouldn't copy the resources here, but it does |
|
rm -rf "$release_name/Resources" |
|
|
|
mv rust-build/ErsatzTV-Windows.exe "$release_name/ErsatzTV-Windows.exe" |
|
|
|
# download next artifacts |
|
gh release download develop --repo ErsatzTV/next --pattern "ersatztv-next-*-windows-x64.zip" --dir next-download |
|
7z x next-download/*.zip -onext-extracted |
|
mv next-extracted/ersatztv-next-*/ersatztv-channel.exe "$release_name/" |
|
rm -rf next-download next-extracted |
|
|
|
7z e "ffmpeg/${{ steps.downloadffmpeg.outputs.filename }}" -o"$release_name" '*.exe' -r |
|
rm -f "$release_name/ffplay.exe" |
|
|
|
(cd "${release_name}" && 7z a "../${release_name}.zip" .) |
|
|
|
- name: Delete old release assets |
|
if: ${{ inputs.release_tag == 'develop' }} |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: | |
|
gh release view ${{ inputs.release_tag }} --json assets --jq '.assets[].name' --repo ${{ github.repository }} \ |
|
| grep 'win-x64.zip' \ |
|
| xargs -r -I{} gh release delete-asset ${{ inputs.release_tag }} {} --yes --repo ${{ github.repository }} |
|
|
|
- name: Publish |
|
env: |
|
GH_TOKEN: ${{ github.token }} |
|
run: gh release upload ${{ inputs.release_tag }} "${{ env.RELEASE_NAME }}.zip" --repo ${{ github.repository }} |
|
ease upload ${{ inputs.release_tag }} "${{ env.RELEASE_NAME }}.zip" --repo ${{ github.repository }}
|
|
|