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.
238 lines
8.4 KiB
238 lines
8.4 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 |
|
jobs: |
|
build_and_upload_mac: |
|
name: Mac Build & Upload |
|
runs-on: ${{ matrix.os }} |
|
if: contains(github.event.head_commit.message, '[no build]') == false |
|
strategy: |
|
matrix: |
|
include: |
|
- os: macos-12 |
|
kind: macOS |
|
target: osx-x64 |
|
- os: macos-12 |
|
kind: macOS |
|
target: osx-arm64 |
|
steps: |
|
- name: Get the sources |
|
uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
submodules: true |
|
|
|
- name: Setup .NET Core |
|
uses: actions/setup-dotnet@v4 |
|
|
|
- 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-${{ 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 net8.0 --runtime "${{ matrix.target }}" -c Release -o publish -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 net8.0 --runtime "${{ matrix.target }}" -c Release -o publish -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" \ |
|
--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 \ |
|
"ErsatzTV.dmg" \ |
|
"ErsatzTV.app/" |
|
|
|
- name: Notarize |
|
shell: bash |
|
run: | |
|
xcrun notarytool submit ErsatzTV.dmg --apple-id "${{ secrets.ac_username }}" --password "${{ secrets.ac_password }}" --team-id 32MB98Q32R --wait |
|
xcrun stapler staple ErsatzTV.dmg |
|
|
|
- name: Cleanup |
|
shell: bash |
|
run: | |
|
mv ErsatzTV.dmg "${{ env.RELEASE_NAME }}.dmg" |
|
rm -r publish |
|
rm -r ErsatzTV.app |
|
|
|
- name: Delete old release assets |
|
uses: mknejp/delete-release-assets@v1 |
|
if: ${{ inputs.release_tag == 'develop' }} |
|
with: |
|
token: ${{ secrets.gh_token }} |
|
tag: ${{ inputs.release_tag }} |
|
fail-if-no-assets: false |
|
assets: | |
|
*${{ matrix.target }}.dmg |
|
|
|
- name: Publish |
|
uses: softprops/action-gh-release@v1 |
|
with: |
|
prerelease: true |
|
tag_name: ${{ inputs.release_tag }} |
|
files: | |
|
${{ env.RELEASE_NAME }}.dmg |
|
env: |
|
GITHUB_TOKEN: ${{ secrets.gh_token }} |
|
build_and_upload: |
|
name: Build & Upload |
|
runs-on: ${{ matrix.os }} |
|
if: contains(github.event.head_commit.message, '[no build]') == false |
|
strategy: |
|
matrix: |
|
include: |
|
- os: ubuntu-latest |
|
kind: linux |
|
target: linux-x64 |
|
- os: ubuntu-latest |
|
kind: linux |
|
target: linux-arm |
|
- os: ubuntu-latest |
|
kind: linux |
|
target: linux-arm64 |
|
- os: windows-latest |
|
kind: windows |
|
target: win-x64 |
|
steps: |
|
- name: Get the sources |
|
uses: actions/checkout@v4 |
|
with: |
|
fetch-depth: 0 |
|
|
|
- name: Setup .NET Core |
|
uses: actions/setup-dotnet@v4 |
|
|
|
- name: Clean |
|
run: dotnet clean --configuration Release && dotnet nuget locals all --clear |
|
|
|
- name: Install dependencies |
|
run: dotnet restore -r "${{ matrix.target }}" |
|
|
|
- uses: suisei-cn/actions-download-file@v1.3.0 |
|
if: ${{ matrix.kind == 'windows' }} |
|
id: downloadffmpeg |
|
name: Download ffmpeg |
|
with: |
|
url: "https://github.com/ErsatzTV/ErsatzTV-ffmpeg/releases/download/6.1-working-cuvid/ffmpeg-6.1-working-cuvid.7z" |
|
target: ffmpeg/ |
|
|
|
- name: Build |
|
shell: bash |
|
run: | |
|
# Define some variables for things we need |
|
release_name="ErsatzTV-${{ 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 net8.0 --runtime "${{ matrix.target }}" -c Release -o "scanner" -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 net8.0 --runtime "${{ matrix.target }}" -c Release -o "main" -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/" |
|
|
|
# Build Windows launcher |
|
if [ "${{ matrix.kind }}" == "windows" ]; then |
|
cargo build --manifest-path=ErsatzTV-Windows/Cargo.toml --release --all-features |
|
ls -l ErsatzTV-Windows/target/release |
|
mv ErsatzTV-Windows/target/release/ersatztv_windows.exe "$release_name/ErsatzTV-Windows.exe" |
|
fi |
|
|
|
# Download ffmpeg |
|
if [ "${{ matrix.kind }}" == "windows" ]; then |
|
7z e "ffmpeg/${{ steps.downloadffmpeg.outputs.filename }}" -o"$release_name" '*.exe' -r |
|
rm -f "$release_name/ffplay.exe" |
|
fi |
|
|
|
# Pack files |
|
if [ "${{ matrix.kind }}" == "windows" ]; then |
|
7z a -tzip "${release_name}.zip" "./${release_name}/*" |
|
else |
|
tar czvf "${release_name}.tar.gz" "$release_name" |
|
fi |
|
|
|
# Delete output directory |
|
rm -r "$release_name" |
|
|
|
- name: Delete old release assets |
|
uses: mknejp/delete-release-assets@v1 |
|
if: ${{ inputs.release_tag == 'develop' }} |
|
with: |
|
token: ${{ secrets.gh_token }} |
|
tag: ${{ inputs.release_tag }} |
|
fail-if-no-assets: false |
|
assets: | |
|
*${{ matrix.target }}.zip |
|
*${{ matrix.target }}.tar.gz |
|
|
|
- name: Publish |
|
uses: softprops/action-gh-release@v1 |
|
with: |
|
prerelease: true |
|
tag_name: ${{ inputs.release_tag }} |
|
files: | |
|
${{ env.RELEASE_NAME }}.zip |
|
${{ env.RELEASE_NAME }}.tar.gz |
|
env: |
|
GITHUB_TOKEN: ${{ secrets.gh_token }}
|
|
|