diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5c9814c..b55e64c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -62,7 +62,7 @@ jobs: - name: Download and copy files shell: pwsh run: | - .\scripts\deploy-windows.ps1 -TargetName "${{ env.TARGET_NAME }}" -DisplayName "${{ env.DISPLAY_NAME }}" -BuildDir "build" -Architecture "amd64" + .\scripts\deploy-windows.ps1 -TargetName "${{ env.TARGET_NAME }}" -DisplayName "${{ env.DISPLAY_NAME }}" -BuildDir "build" -Architecture "amd64" -Nightly ${{ inputs.nightly || github.event_name != 'release' }} Compress-Archive -Path "${{ env.DISPLAY_NAME }}" -DestinationPath ${{ env.ARCHIVE_NAME }}.zip - name: Upload artifact @@ -110,7 +110,7 @@ jobs: - name: Download and copy files shell: pwsh run: | - .\scripts\deploy-windows.ps1 -TargetName "${{ env.TARGET_NAME }}" -DisplayName "${{ env.DISPLAY_NAME }}" -BuildDir "build" -Architecture "arm64" + .\scripts\deploy-windows.ps1 -TargetName "${{ env.TARGET_NAME }}" -DisplayName "${{ env.DISPLAY_NAME }}" -BuildDir "build" -Architecture "arm64" -Nightly ${{ inputs.nightly || github.event_name != 'release' }} Compress-Archive -Path "${{ env.DISPLAY_NAME }}" -DestinationPath ${{ env.ARCHIVE_NAME }}.zip - name: Upload artifact @@ -156,7 +156,7 @@ jobs: - name: Download and copy files run: | - ./scripts/deploy-macos.sh "${{ env.TARGET_NAME }}" "build" "x86_64" + ./scripts/deploy-macos.sh "${{ env.TARGET_NAME }}" "build" "x86_64" "${{ inputs.nightly || github.event_name != 'release' }}" - name: Import macOS signing certificate if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' @@ -261,7 +261,7 @@ jobs: - name: Download and copy files run: | - ./scripts/deploy-macos.sh "${{ env.TARGET_NAME }}" "build" "arm64" + ./scripts/deploy-macos.sh "${{ env.TARGET_NAME }}" "build" "arm64" "${{ inputs.nightly || github.event_name != 'release' }}" - name: Import macOS signing certificate if: github.event_name == 'release' || github.event_name == 'workflow_dispatch' @@ -366,7 +366,7 @@ jobs: - name: Download and copy files run: | - ./scripts/deploy-linux.sh "${{ env.TARGET_NAME }}" "${{ env.DISPLAY_NAME }}" "build" "x86_64" + ./scripts/deploy-linux.sh "${{ env.TARGET_NAME }}" "${{ env.DISPLAY_NAME }}" "build" "x86_64" "${{ inputs.nightly || github.event_name != 'release' }}" mv *.AppImage ${{ env.ARCHIVE_NAME }}.AppImage - name: Upload artifact @@ -417,7 +417,7 @@ jobs: - name: Download and copy files run: | - ./scripts/deploy-linux.sh "${{ env.TARGET_NAME }}" "${{ env.DISPLAY_NAME }}" "build" "arm64" + ./scripts/deploy-linux.sh "${{ env.TARGET_NAME }}" "${{ env.DISPLAY_NAME }}" "build" "arm64" "${{ inputs.nightly || github.event_name != 'release' }}" mv *.AppImage ${{ env.ARCHIVE_NAME }}.AppImage - name: Upload artifact diff --git a/scripts/deploy-linux.sh b/scripts/deploy-linux.sh index e625895..8b9be87 100755 --- a/scripts/deploy-linux.sh +++ b/scripts/deploy-linux.sh @@ -1,6 +1,6 @@ #!/bin/bash # Linux deployment script -# Usage: ./scripts/deploy-linux.sh "EZ4Connect" "EZ4Connect" "build" "x86_64" +# Usage: ./scripts/deploy-linux.sh "EZ4Connect" "EZ4Connect" "build" "x86_64" "false" set -euo pipefail @@ -8,6 +8,7 @@ TARGET_NAME="${1:-EZ4Connect}" DISPLAY_NAME="${2:-EZ4Connect}" BUILD_DIR="${3:-build}" ARCH="${4:-x86_64}" +NIGHTLY="${5:-false}" # Determine AppImage tool architecture if [ "$ARCH" = "x86_64" ]; then @@ -48,7 +49,12 @@ if [ "$ARCH" = "x86_64" ]; then ZJU_ARCH="amd64" fi -wget -O "zju-connect-linux-$ZJU_ARCH.zip" "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-linux-$ZJU_ARCH.zip" +ZJU_RELEASE_PATH="latest/download" +if [ "$NIGHTLY" = "true" ]; then + ZJU_RELEASE_PATH="download/nightly" +fi + +wget -O "zju-connect-linux-$ZJU_ARCH.zip" "https://github.com/Mythologyli/zju-connect/releases/$ZJU_RELEASE_PATH/zju-connect-linux-$ZJU_ARCH.zip" unzip -o "zju-connect-linux-$ZJU_ARCH.zip" cp zju-connect AppDir/usr/bin/ rm "zju-connect-linux-$ZJU_ARCH.zip" diff --git a/scripts/deploy-macos.sh b/scripts/deploy-macos.sh index e37b669..1e987b3 100755 --- a/scripts/deploy-macos.sh +++ b/scripts/deploy-macos.sh @@ -1,12 +1,13 @@ #!/bin/bash # macOS deployment script -# Usage: ./scripts/deploy-macos.sh "EZ4Connect" "build" "amd64" +# Usage: ./scripts/deploy-macos.sh "EZ4Connect" "build" "amd64" "false" set -euo pipefail TARGET_NAME="${1:-EZ4Connect}" BUILD_DIR="${2:-build}" ARCH="${3:-arm64}" +NIGHTLY="${4:-false}" APP_PATH="$TARGET_NAME.app" # Copy app bundle @@ -18,7 +19,12 @@ if [ "$ARCH" = "x86_64" ]; then ZJU_ARCH="amd64" fi -curl -LO "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-darwin-$ZJU_ARCH.zip" +ZJU_RELEASE_PATH="latest/download" +if [ "$NIGHTLY" = "true" ]; then + ZJU_RELEASE_PATH="download/nightly" +fi + +curl -LO "https://github.com/Mythologyli/zju-connect/releases/$ZJU_RELEASE_PATH/zju-connect-darwin-$ZJU_ARCH.zip" unzip -o "zju-connect-darwin-$ZJU_ARCH.zip" rm "zju-connect-darwin-$ZJU_ARCH.zip" diff --git a/scripts/deploy-windows.ps1 b/scripts/deploy-windows.ps1 index 016362d..87c5e39 100755 --- a/scripts/deploy-windows.ps1 +++ b/scripts/deploy-windows.ps1 @@ -1,11 +1,12 @@ # Windows deployment script -# Usage: .\deploy-windows.ps1 -TargetName "EZ4Connect" -DisplayName "EZ4Connect" -BuildDir "build" -Architecture "amd64" +# Usage: .\deploy-windows.ps1 -TargetName "EZ4Connect" -DisplayName "EZ4Connect" -BuildDir "build" -Architecture "amd64" -Nightly "false" param( [string]$TargetName = "EZ4Connect", [string]$DisplayName = "EZ4Connect", [string]$BuildDir = "build", - [string]$Architecture = "amd64" + [string]$Architecture = "amd64", + [string]$Nightly = "false" ) Import-Module -Name Microsoft.PowerShell.Utility @@ -21,7 +22,8 @@ Copy-Item -Path "../$BuildDir/Release/$TargetName.exe" -Destination . & windeployqt.exe "$TargetName.exe" # Download and extract zju-connect -$ZjuUrl = "https://github.com/Mythologyli/zju-connect/releases/latest/download/zju-connect-windows-$Architecture.zip" +$ZjuReleasePath = if ($Nightly -eq "true") { "download/nightly" } else { "latest/download" } +$ZjuUrl = "https://github.com/Mythologyli/zju-connect/releases/$ZjuReleasePath/zju-connect-windows-$Architecture.zip" $ZjuZipPath = "zju-connect-windows-$Architecture.zip" Invoke-WebRequest -Uri $ZjuUrl -OutFile $ZjuZipPath Expand-Archive -Path $ZjuZipPath -DestinationPath . -Force