update #15
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: DDTV5_Test | |
on: | |
push: | |
tags: | |
- "test*" | |
pull_request: | |
paths: | |
- 'Server/**' | |
- 'Client/**' | |
- 'Desktop/**' | |
- '!**/README.md' | |
workflow_dispatch: | |
jobs: | |
Server: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
runtime: win-x64 | |
- os: macOS-latest | |
runtime: osx-arm64 | |
- os: ubuntu-latest | |
runtime: linux-x64 | |
- os: ubuntu-latest | |
runtime: linux-arm | |
- os: ubuntu-latest | |
runtime: linux-arm64 | |
- os: ubuntu-latest | |
runtime: linux-musl-x64 | |
- os: ubuntu-latest | |
runtime: linux-musl-arm | |
- os: ubuntu-latest | |
runtime: linux-musl-arm64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Remove all .NET SDKs | |
if: runner.os != 'Windows' | |
run: sudo rm -rf /usr/share/dotnet/sdk/* | |
- name: Remove all .NET SDKs (Windows) | |
if: runner.os == 'Windows' | |
run: Remove-Item -Recurse -Force "C:\Program Files\dotnet\sdk\*" | |
shell: pwsh | |
- name: Setup .NET 8.0.303 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.303' | |
- name: Check .NET SDK version | |
run: dotnet --version | |
- name: Download and extract latest release (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
mkdir -p Static | |
header="authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" | |
FILE_URL=$(curl -sH "$header" "https://api.github.com/repos/moehuhu/DDTV_GUI_React/releases/latest" \ | |
| grep "browser_download_url.*ddtv-gui-react_v.*\.zip" \ | |
| cut -d : -f 2,3 \ | |
| tr -d \") | |
wget --header="$header" $FILE_URL -O ddtv-gui-react.zip | |
unzip ddtv-gui-react.zip -d Static | |
rm ddtv-gui-react.zip | |
shell: bash | |
- name: Download and extract latest release (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
mkdir Static | |
$header = @{ | |
Authorization = "Bearer ${{ secrets.GITHUB_TOKEN }}" | |
} | |
$url = Invoke-RestMethod -Uri https://api.github.com/repos/moehuhu/DDTV_GUI_React/releases/latest -Headers $header | |
$fileUrl = $url.assets | Where-Object { $_.name -match "ddtv-gui-react_v.*\.zip" } | Select-Object -ExpandProperty browser_download_url | |
Invoke-WebRequest -Uri $fileUrl -OutFile ddtv-gui-react.zip -Headers $header | |
Expand-Archive -Path ddtv-gui-react.zip -DestinationPath Static | |
Remove-Item -Path ddtv-gui-react.zip | |
shell: powershell | |
- name: Replace string with current date (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
export TZ='Asia/Shanghai' | |
current_date=$(date +%Y-%m-%d) | |
current_time=$(date +%H:%M:%S) | |
combined_date_time="${current_date} ${current_time}" | |
echo ${combined_date_time} | |
sed -i.bak "s/CompilationTime/${combined_date_time}/g" Core/Init.cs | |
- name: Replace string with current date (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$beijingTime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('China Standard Time')) | |
$current_date = $beijingTime.ToString("yyyy-MM-dd") | |
$current_time = $beijingTime.ToString("HH:mm:ss") | |
$combined_date_time = "$current_date $current_time" | |
Write-Output $combined_date_time | |
(Get-Content Core/Init.cs) -replace 'CompilationTime', $combined_date_time | Set-Content Core/Init.cs | |
- name: Modify default update mode (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
export TZ='Asia/Shanghai' | |
current_date=$(date +%Y-%m-%d) | |
current_time=$(date +%H:%M:%S) | |
combined_date_time="${current_date} ${current_time}" | |
echo ${combined_date_time} | |
sed -i.bak 's/string DevelopmentVersion = "false"/string DevelopmentVersion = "true"/g' Core/Config.cs | |
- name: Modify default update mode (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$beijingTime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('China Standard Time')) | |
$current_date = $beijingTime.ToString("yyyy-MM-dd") | |
$current_time = $beijingTime.ToString("HH:mm:ss") | |
$combined_date_time = "$current_date $current_time" | |
Write-Output $combined_date_time | |
(Get-Content Core/Config.cs) -replace 'string DevelopmentVersion = "false"', 'string DevelopmentVersion = "true"' | Set-Content Core/Config.cs | |
- name: Replace VerString (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
TAG_NAME=${GITHUB_REF#refs/tags/} | |
VERSION_NUMBER=$(echo $TAG_NAME | sed -n -E 's/^test([0-9]+\.[0-9]+\.[0-9]+)$/\1/p') | |
COMMIT_COUNT=$(git rev-list --count HEAD) | |
FINAL_VERSION="${VERSION_NUMBER}.${COMMIT_COUNT}" | |
echo ${FINAL_VERSION} | |
sed -i.bak "s/5.0.0.0/${FINAL_VERSION}/g" Core/Core.csproj | |
sed -i.bak "s/5.0.0.0/${FINAL_VERSION}/g" Server/Server.csproj | |
- name: Replace VerString (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$TAG_NAME = "${env:GITHUB_REF}".Replace("refs/tags/", "") | |
$VERSION_NUMBER = $TAG_NAME -replace ".*?(\d+\.\d+\.\d+).*", '$1' | |
$COMMIT_COUNT = git rev-list --count HEAD | |
$FINAL_VERSION = "$VERSION_NUMBER.$COMMIT_COUNT" | |
Write-Output $FINAL_VERSION | |
(Get-Content Core/Core.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Core/Core.csproj | |
(Get-Content Server/Server.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Server/Server.csproj | |
shell: pwsh | |
- name: Build Server | |
run: cd Server && dotnet publish --runtime ${{ matrix.runtime }} --configuration Release --self-contained true --output build_output | |
- name: Build Update | |
run: cd Update && dotnet publish --runtime ${{ matrix.runtime }} --configuration Release --self-contained true --output build_update_output | |
- name: Move Update (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
source="Update/build_update_output/*" | |
destination="Server/build_output/Update" | |
mkdir -p $destination | |
mv $source $destination | |
- name: Move Update (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$source = "Update/build_update_output/*" | |
$destination = "Server/build_output/Update" | |
New-Item -ItemType Directory -Force -Path $destination | |
Move-Item -Path $source -Destination $destination | |
- name: Copy Static folder to build_output | |
run: cp -r Static Server/build_output/Static | |
- name: Download ffmpeg.exe (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
mkdir Server/build_output/Plugins/Plugins/ffmpeg | |
curl -L -o ffmpeg.zip https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip | |
tar -xf ffmpeg.zip --directory Server/build_output/Plugins/Plugins/ffmpeg --strip-components=1 ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe | |
- name: Move all files to bin folder and create shortcut (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
mkdir -p Server/build_output/bin | |
find Server/build_output -mindepth 1 -maxdepth 1 ! -name bin -exec mv {} Server/build_output/bin \; | |
echo "Creating shortcut for Server" | |
echo "#!/bin/bash" > Server/build_output/DDTV_Server.sh | |
echo "dir=\$(cd \"\$(dirname \"\$0\")\"; pwd)" >> Server/build_output/DDTV_Server.sh | |
echo '"$dir/bin/Server"' >> Server/build_output/DDTV_Server.sh | |
chmod +x Server/build_output/DDTV_Server.sh | |
- name: Move all files to bin folder and create shortcut (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Get-ChildItem -Path "Server/build_output" | Move-Item -Destination "Server/build_output/bin" | |
$bat_file_path = "Server/build_output/启动DDTV_Server.bat" | |
$command = @" | |
setlocal EnableDelayedExpansion | |
set "abs_path=%~dp0" | |
cd %abs_path%bin | |
start Server.exe | |
"@ | |
Set-Content -Path $bat_file_path -Value $command | |
- name: Add VersionFile (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
echo "type=DDTV-Server-${{ matrix.os }}-${{ matrix.runtime }}" > Server/build_output/bin/ver.ini | |
echo "ver=${{ github.ref_name }}" >> Server/build_output/bin/ver.ini | |
- name: Add VersionFile (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$bat_file_path = "Server/build_output/bin/ver.ini" | |
$command = @" | |
type=DDTV-Server-${{ matrix.os }}-${{ matrix.runtime }} | |
ver=${{ github.ref_name }} | |
"@ | |
Set-Content -Path $bat_file_path -Value $command | |
- name: List all files (Linux or macOS) | |
if: runner.os != 'Windows' | |
run: | | |
echo "Absolute paths:" | |
find "$(pwd)/Server/build_output" -type f | |
echo "Relative paths:" | |
find Server/build_output -type f | |
shell: bash | |
- name: List all files (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
echo "Absolute paths:" | |
Get-ChildItem -Path "$(Resolve-Path Server/build_output)" -File -Recurse | ForEach-Object FullName | |
echo "Relative paths:" | |
Get-ChildItem -Path "Server/build_output" -File -Recurse | ForEach-Object Name | |
shell: powershell | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DDTV-Server-${{ matrix.os }}-${{ matrix.runtime }} | |
path: Server/build_output | |
Desktop: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
runtime: win-x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Remove all .NET SDKs (Windows) | |
if: runner.os == 'Windows' | |
run: Remove-Item -Recurse -Force "C:\Program Files\dotnet\sdk\*" | |
shell: pwsh | |
- name: Setup .NET 8.0.303 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.303' | |
- name: Check .NET SDK version | |
run: dotnet --version | |
- name: Download and extract latest release (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
mkdir Static | |
$header = @{ | |
Authorization = "Bearer ${{ secrets.GITHUB_TOKEN }}" | |
} | |
$url = Invoke-RestMethod -Uri https://api.github.com/repos/moehuhu/DDTV_GUI_React/releases/latest -Headers $header | |
$fileUrl = $url.assets | Where-Object { $_.name -match "ddtv-gui-react_v.*\.zip" } | Select-Object -ExpandProperty browser_download_url | |
Invoke-WebRequest -Uri $fileUrl -OutFile ddtv-gui-react.zip -Headers $header | |
Expand-Archive -Path ddtv-gui-react.zip -DestinationPath Static | |
Remove-Item -Path ddtv-gui-react.zip | |
shell: powershell | |
- name: Replace string with current date (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$beijingTime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('China Standard Time')) | |
$current_date = $beijingTime.ToString("yyyy-MM-dd") | |
$current_time = $beijingTime.ToString("HH:mm:ss") | |
$combined_date_time = "$current_date $current_time" | |
Write-Output $combined_date_time | |
(Get-Content Core/Init.cs) -replace 'CompilationTime', $combined_date_time | Set-Content Core/Init.cs | |
- name: Replace VerString (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$TAG_NAME = "${env:GITHUB_REF}".Replace("refs/tags/", "") | |
$VERSION_NUMBER = $TAG_NAME -replace ".*?(\d+\.\d+\.\d+).*", '$1' | |
$COMMIT_COUNT = git rev-list --count HEAD | |
$FINAL_VERSION = "$VERSION_NUMBER.$COMMIT_COUNT" | |
Write-Output $FINAL_VERSION | |
(Get-Content Core/Core.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Core/Core.csproj | |
(Get-Content Server/Server.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Server/Server.csproj | |
(Get-Content Desktop/Desktop.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Desktop/Desktop.csproj | |
- name: Modify default update mode (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$beijingTime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('China Standard Time')) | |
$current_date = $beijingTime.ToString("yyyy-MM-dd") | |
$current_time = $beijingTime.ToString("HH:mm:ss") | |
$combined_date_time = "$current_date $current_time" | |
Write-Output $combined_date_time | |
(Get-Content Core/Config.cs) -replace 'string DevelopmentVersion = "false"', 'string DevelopmentVersion = "true"' | Set-Content Core/Config.cs | |
shell: pwsh | |
- name: Build | |
run: cd Desktop && dotnet publish --runtime ${{ matrix.runtime }} --configuration Release --self-contained true --output build_output | |
- name: Build Update | |
run: cd Update && dotnet publish --runtime ${{ matrix.runtime }} --configuration Release --self-contained true --output build_update_output | |
- name: Move Update (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$source = "Update/build_update_output/*" | |
$destination = "Desktop/build_output/Update" | |
New-Item -ItemType Directory -Force -Path $destination | |
Move-Item -Path $source -Destination $destination | |
- name: Copy Static folder to build_output | |
run: cp -r Static Desktop/build_output/Static | |
- name: Download ffmpeg.exe (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
mkdir Desktop/build_output/Plugins/Plugins/ffmpeg | |
curl -L -o ffmpeg.zip https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip | |
tar -xf ffmpeg.zip --directory Desktop/build_output/Plugins/Plugins/ffmpeg --strip-components=1 ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe | |
- name: Copy VLC (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
mkdir Desktop/build_output/Plugins/vlc | |
$source = "Desktop/Plugins/vlc/*" | |
$destination = "Desktop/build_output/Plugins/vlc" | |
New-Item -ItemType Directory -Force -Path $destination | |
Move-Item -Path $source -Destination $destination | |
- name: Move all files to bin folder and create shortcut (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Get-ChildItem -Path "Desktop/build_output" | Move-Item -Destination "Desktop/build_output/bin" | |
$bat_file_path = "Desktop/build_output/启动DDTV_Desktop.bat" | |
$command = @" | |
setlocal EnableDelayedExpansion | |
set "abs_path=%~dp0" | |
cd %abs_path%bin | |
start Desktop.exe | |
"@ | |
Set-Content -Path $bat_file_path -Value $command | |
- name: Add VersionFile (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$bat_file_path = "Desktop/build_output/bin/ver.ini" | |
$command = @" | |
type=DDTV-Desktop-${{ matrix.os }}-${{ matrix.runtime }} | |
ver=${{ github.ref_name }} | |
"@ | |
Set-Content -Path $bat_file_path -Value $command | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DDTV-Desktop-${{ matrix.os }}-${{ matrix.runtime }} | |
path: Desktop/build_output | |
Client: | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
runtime: win-x64 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Remove all .NET SDKs (Windows) | |
if: runner.os == 'Windows' | |
run: Remove-Item -Recurse -Force "C:\Program Files\dotnet\sdk\*" | |
shell: pwsh | |
- name: Setup .NET 8.0.303 | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '8.0.303' | |
- name: Check .NET SDK version | |
run: dotnet --version | |
- name: Download and extract latest release (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
mkdir Static | |
$header = @{ | |
Authorization = "Bearer ${{ secrets.GITHUB_TOKEN }}" | |
} | |
$url = Invoke-RestMethod -Uri https://api.github.com/repos/moehuhu/DDTV_GUI_React/releases/latest -Headers $header | |
$fileUrl = $url.assets | Where-Object { $_.name -match "ddtv-gui-react_v.*\.zip" } | Select-Object -ExpandProperty browser_download_url | |
Invoke-WebRequest -Uri $fileUrl -OutFile ddtv-gui-react.zip -Headers $header | |
Expand-Archive -Path ddtv-gui-react.zip -DestinationPath Static | |
Remove-Item -Path ddtv-gui-react.zip | |
shell: powershell | |
- name: Replace string with current date (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$beijingTime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('China Standard Time')) | |
$current_date = $beijingTime.ToString("yyyy-MM-dd") | |
$current_time = $beijingTime.ToString("HH:mm:ss") | |
$combined_date_time = "$current_date $current_time" | |
Write-Output $combined_date_time | |
(Get-Content Core/Init.cs) -replace 'CompilationTime', $combined_date_time | Set-Content Core/Init.cs | |
- name: Modify default update mode (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$beijingTime = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), [System.TimeZoneInfo]::FindSystemTimeZoneById('China Standard Time')) | |
$current_date = $beijingTime.ToString("yyyy-MM-dd") | |
$current_time = $beijingTime.ToString("HH:mm:ss") | |
$combined_date_time = "$current_date $current_time" | |
Write-Output $combined_date_time | |
(Get-Content Core/Config.cs) -replace 'string DevelopmentVersion = "false"', 'string DevelopmentVersion = "true"' | Set-Content Core/Config.cs | |
- name: Replace VerString (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
$TAG_NAME = "${env:GITHUB_REF}".Replace("refs/tags/", "") | |
$VERSION_NUMBER = $TAG_NAME -replace ".*?(\d+\.\d+\.\d+).*", '$1' | |
$COMMIT_COUNT = git rev-list --count HEAD | |
$FINAL_VERSION = "$VERSION_NUMBER.$COMMIT_COUNT" | |
Write-Output $FINAL_VERSION | |
(Get-Content Core/Core.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Core/Core.csproj | |
(Get-Content Server/Server.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Server/Server.csproj | |
(Get-Content Client/Client.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content Client/Client.csproj | |
shell: pwsh | |
- name: Build | |
run: cd Client && dotnet publish --runtime ${{ matrix.runtime }} --configuration Release --self-contained true --output build_output | |
- name: Build Update | |
run: cd Update && dotnet publish --runtime ${{ matrix.runtime }} --configuration Release --self-contained true --output build_update_output | |
- name: Move Update (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$source = "Update/build_update_output/*" | |
$destination = "Client/build_output/Update" | |
New-Item -ItemType Directory -Force -Path $destination | |
Move-Item -Path $source -Destination $destination | |
- name: Copy Static folder to build_output | |
run: cp -r Static Client/build_output/Static | |
- name: Download ffmpeg.exe (Windows) | |
if: matrix.os == 'windows-latest' | |
run: | | |
mkdir Client/build_output/Plugins/Plugins/ffmpeg | |
curl -L -o ffmpeg.zip https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip | |
tar -xf ffmpeg.zip --directory Client/build_output/Plugins/Plugins/ffmpeg --strip-components=1 ffmpeg-master-latest-win64-gpl/bin/ffmpeg.exe | |
- name: Move all files to bin folder and create shortcut (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
Get-ChildItem -Path "Client/build_output" | Move-Item -Destination "Client/build_output/bin" | |
$bat_file_path = "Client/build_output/启动DDTV_Client.bat" | |
$command = @" | |
setlocal EnableDelayedExpansion | |
set "abs_path=%~dp0" | |
cd %abs_path%bin | |
start Client.exe | |
"@ | |
Set-Content -Path $bat_file_path -Value $command | |
- name: Add VersionFile (Windows) | |
if: runner.os == 'Windows' | |
shell: pwsh | |
run: | | |
$bat_file_path = "Client/build_output/bin/ver.ini" | |
$command = @" | |
type=DDTV-Client-${{ matrix.os }}-${{ matrix.runtime }} | |
ver=${{ github.ref_name }} | |
"@ | |
Set-Content -Path $bat_file_path -Value $command | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: DDTV-Client-${{ matrix.os }}-${{ matrix.runtime }} | |
path: Client/build_output |