Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
CHKZL committed Apr 8, 2024
1 parent f8a761e commit 13025ae
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 223 deletions.
34 changes: 0 additions & 34 deletions .github/workflows/DDTV_CLI.yml

This file was deleted.

36 changes: 0 additions & 36 deletions .github/workflows/DDTV_Core.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CLI_Dev
name: Dev

on:
push:
Expand All @@ -8,11 +8,13 @@ on:
paths:
- 'CLI/**'
- '.github/workflows/DDTV_Dev_CLI.yml'
- 'GUI/**'
- '.github/workflows/DDTV_Dev_GUI.yml'
- '!**/README.md'
workflow_dispatch:

jobs:
build:
CLI:
strategy:
matrix:
include:
Expand Down Expand Up @@ -174,3 +176,93 @@ jobs:
runtime: ${{ matrix.runtime }}
image_id: ${{ contains(matrix.runtime, 'musl') && 'alpine' || 'debian' }}
build-args: REPO=mcr.microsoft.com/dotnet/runtime-deps:${{ contains(matrix.runtime, 'musl') && '8.0-alpine' || '8.0' }}

GUI:
strategy:
matrix:
include:
- os: windows-latest
runtime: win-x86
- os: windows-latest
runtime: win-x64

runs-on: ${{ matrix.os }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Use .NET 8.x
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'

- 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 CLI/CLI.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content CLI/CLI.csproj
(Get-Content GUI/GUI.csproj) | Foreach-Object { $_ -replace "5.0.0.0", $FINAL_VERSION } | Set-Content GUI/GUI.csproj
shell: pwsh

- name: Build
run: cd GUI && dotnet publish --runtime ${{ matrix.runtime }} --configuration Release --self-contained true --output build_output

- name: Copy static folder to build_output
run: cp -r static GUI/build_output/static

- name: Copy ffmpeg.exe (Windows)
if: matrix.os == 'windows-latest'
run: |
mkdir GUI\\build_output\\plugins\\plugins\\ffmpeg
copy GUI\\plugins\\ffmpeg\\ffmpeg.exe GUI\\build_output\\plugins\\plugins\\ffmpeg\\ffmpeg.exe
- name: Move all files to bin folder and create shortcut (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Get-ChildItem -Path "GUI/build_output" | Move-Item -Destination "GUI/build_output/bin"
echo "Creating shortcut for GUI.exe"
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("GUI\build_output\DDTV_GUI.lnk")
$Shortcut.TargetPath = "C:\Windows\explorer.exe"
$Shortcut.Arguments="bin\GUI.exe"
$Shortcut.Save()
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: DDTV-GUI-${{ matrix.os }}-${{ matrix.runtime }}
path: GUI/build_output
55 changes: 0 additions & 55 deletions .github/workflows/DDTV_GUI.yml

This file was deleted.

62 changes: 0 additions & 62 deletions .github/workflows/DDTV_Release_CLI.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/DDTV_WEB_Server.yml

This file was deleted.

0 comments on commit 13025ae

Please sign in to comment.