Commit 318aa57684
Unsigned
Layout: unified · split
.github/workflows/ci-cd.yml +73 −51
| @@ -14,12 +14,14 @@ jobs: | |||
| 14 | 14 | ||
| 15 | steps: | 15 | steps: |
| 16 | - name: Checkout code | 16 | - name: Checkout code |
| 17 | uses: actions/checkout@v2 | 17 | uses: actions/checkout@v4 |
| 18 | with: | ||
| 19 | fetch-depth: 0 # Fetch all history and tags | ||
| 18 | 20 | ||
| 19 | - name: Set up Go | 21 | - name: Set up Go |
| 20 | uses: actions/setup-go@v2 | 22 | uses: actions/setup-go@v2 |
| 21 | with: | 23 | with: |
| 22 | go-version: '1.23.2' | 24 | go-version: '1.24.0' |
| 23 | 25 | ||
| 24 | - name: Install Dependencies | 26 | - name: Install Dependencies |
| 25 | run: go mod tidy | 27 | run: go mod tidy |
| @@ -27,57 +29,68 @@ jobs: | |||
| 27 | - name: Build Linux binary | 29 | - name: Build Linux binary |
| 28 | run: | | 30 | run: | |
| 29 | ./Build/buildlinux | 31 | ./Build/buildlinux |
| 32 | mkdir -p release/linux | ||
| 33 | mv curd-linux-x86_64 release/linux/ | ||
| 30 | 34 | ||
| 31 | - name: Build macOS Intel binary | 35 | - name: Build macOS x86_64 binary |
| 32 | run: | | 36 | run: | |
| 33 | ./Build/buildmac | 37 | ./Build/buildmac-x86_64 |
| 34 | 38 | ||
| 35 | - name: Build macOS ARM64 binary | 39 | - name: Build macOS ARM64 binary |
| 36 | run: | | 40 | run: | |
| 37 | ./Build/buildmac-arm64 | 41 | ./Build/buildmac-arm64 |
| 38 | 42 | ||
| 39 | - name: Create Universal macOS binary | 43 | - name: Install LLVM |
| 40 | run: | | 44 | run: | |
| 41 | mkdir -p Build/macos | 45 | sudo apt-get update && sudo apt-get install -y llvm |
| 42 | mv curd Build/macos/curd-amd64 | 46 | # Find the llvm-lipo command |
| 43 | mv curd-arm64 Build/macos/curd-arm64 | 47 | LIPO_CMD=$(find /usr/bin -name "llvm-lipo*" | head -n 1) |
| 44 | lipo -create Build/macos/curd-amd64 Build/macos/curd-arm64 -output Build/macos/curd | 48 | echo "Found lipo command: $LIPO_CMD" |
| 45 | rm Build/macos/curd-amd64 Build/macos/curd-arm64 | 49 | echo "LIPO_CMD=$LIPO_CMD" >> $GITHUB_ENV |
| 46 | 50 | ||
| 47 | - name: Revert Changes in player.go | 51 | - name: Create Universal macOS binary |
| 48 | run: | | 52 | run: | |
| 49 | git checkout -- internal/player.go | 53 | ${{ env.LIPO_CMD }} -create "curd-macos-x86_64" "curd-macos-arm64" -output "curd-macos-universal" |
| 54 | mkdir -p release/macos | ||
| 55 | mv curd-macos-x86_64 release/macos | ||
| 56 | mv curd-macos-arm64 release/macos | ||
| 57 | mv curd-macos-universal release/macos | ||
| 50 | 58 | ||
| 51 | - name: Build Windows binary (cross-compile) | 59 | - name: Build Windows binary (cross-compile) |
| 52 | run: | | 60 | run: | |
| 53 | ./Build/buildwindows | 61 | ./Build/buildwindows |
| 62 | mkdir -p release/windows | ||
| 63 | mv curd-windows.exe release/windows | ||
| 54 | 64 | ||
| 55 | - name: Upload Artifacts | 65 | - name: Upload Artifacts |
| 56 | uses: actions/upload-artifact@v4 | 66 | uses: actions/upload-artifact@v4 |
| 57 | with: | 67 | with: |
| 58 | name: curd-binaries | 68 | name: curd-binaries |
| 59 | path: | | 69 | path: | |
| 60 | Build/curd | 70 | release/linux/curd-linux-x86_64 |
| 61 | Build/curd.exe | 71 | release/macos/curd-macos-x86_64 |
| 62 | Build/macos/curd | 72 | release/macos/curd-macos-arm64 |
| 73 | release/macos/curd-macos-universal | ||
| 74 | release/windows/curd-windows.exe | ||
| 63 | retention-days: 1 | 75 | retention-days: 1 |
| 64 | if-no-files-found: error | 76 | if-no-files-found: error |
| 65 | 77 | ||
| 66 | - name: List Build Directory | ||
| 67 | run: | | ||
| 68 | echo "Listing contents of Build directory:" | ||
| 69 | ls -R Build | ||
| 70 | |||
| 71 | release: | 78 | release: |
| 72 | runs-on: windows-latest # Use Windows runner for creating the installer | 79 | runs-on: windows-latest |
| 73 | needs: build # Ensure the build job is complete before running this job | 80 | needs: build |
| 74 | if: github.ref == 'refs/heads/main' && github.event_name == 'push' # Only run on pushes to main | 81 | permissions: |
| 82 | contents: write | ||
| 83 | actions: read | ||
| 84 | if: | | ||
| 85 | github.ref == 'refs/heads/main' && | ||
| 86 | github.event_name == 'push' && | ||
| 87 | (contains(github.event.head_commit.message, 'release:')) | ||
| 75 | 88 | ||
| 76 | steps: | 89 | steps: |
| 77 | - name: Checkout code | 90 | - name: Checkout code |
| 78 | uses: actions/checkout@v2 | 91 | uses: actions/checkout@v4 |
| 79 | with: | 92 | with: |
| 80 | lfs: true | 93 | fetch-depth: 0 |
| 81 | 94 | ||
| 82 | - name: Download and extract MPV binary | 95 | - name: Download and extract MPV binary |
| 83 | run: | | 96 | run: | |
| @@ -95,32 +108,39 @@ jobs: | |||
| 95 | with: | 108 | with: |
| 96 | name: curd-binaries | 109 | name: curd-binaries |
| 97 | path: Build | 110 | path: Build |
| 98 | repository: ${{ github.repository }} # Explicitly set repository | ||
| 99 | github-token: ${{ secrets.GITHUB_TOKEN }} # Add token for authentication | ||
| 100 | 111 | ||
| 101 | - name: Bump Version | 112 | - name: Organize Release Files |
| 102 | id: bump_version | ||
| 103 | run: | | 113 | run: | |
| 104 | $current_version = Get-Content VERSION.txt | 114 | $version = Get-Content VERSION.txt |
| 105 | $version_parts = $current_version -split '\.' | 115 | echo "CURD_VERSION=$version" >> $env:GITHUB_ENV |
| 106 | $major = $version_parts[0] | 116 | $release_dir = "releases/curd-$version" |
| 107 | $minor = $version_parts[1] | 117 | |
| 108 | $patch = [int]$version_parts[2] + 1 | 118 | # Create directory structure |
| 109 | $new_version = "$major.$minor.$patch" | 119 | New-Item -ItemType Directory -Force -Path "$release_dir/windows" |
| 110 | $new_version | Set-Content VERSION.txt | 120 | New-Item -ItemType Directory -Force -Path "$release_dir/macos" |
| 111 | git config user.name "GitHub Actions" | 121 | New-Item -ItemType Directory -Force -Path "$release_dir/linux" |
| 112 | git config user.email "actions@github.com" | 122 | |
| 113 | git add VERSION.txt | 123 | # List contents of Build directory to debug |
| 114 | git commit -m "Bump version to $new_version" | 124 | Write-Host "Contents of Build directory:" |
| 115 | git tag "v$new_version" | 125 | Get-ChildItem -Path "Build" -Recurse |
| 116 | echo "::set-output name=new_version::$new_version" | 126 | |
| 127 | # Move files to their respective directories | ||
| 128 | Move-Item "Build/windows/curd-windows.exe" "$release_dir/windows/" | ||
| 129 | Move-Item "Build/macos/curd-macos-universal" "$release_dir/macos/" | ||
| 130 | Move-Item "Build/macos/curd-macos-x86_64" "$release_dir/macos/" | ||
| 131 | Move-Item "Build/macos/curd-macos-arm64" "$release_dir/macos/" | ||
| 132 | Move-Item "Build/linux/curd-linux-x86_64" "$release_dir/linux/" | ||
| 133 | Copy-Item "Build/mpv/mpv.exe" "$release_dir/windows/" | ||
| 134 | shell: pwsh | ||
| 117 | 135 | ||
| 118 | - name: Update Inno Setup Script with New Version | 136 | - name: Update Inno Setup Script with New Version |
| 119 | run: | | 137 | run: | |
| 120 | $new_version = Get-Content VERSION.txt | ||
| 121 | $iss_path = "Build/curd-windows-build.iss" | 138 | $iss_path = "Build/curd-windows-build.iss" |
| 122 | (Get-Content $iss_path) -replace "AppVersion=.*", "AppVersion=$new_version" | Set-Content $iss_path | 139 | $content = Get-Content $iss_path |
| 123 | 140 | $content = $content -replace '^AppVersion=.*', "AppVersion=$env:CURD_VERSION" | |
| 141 | Set-Content $iss_path $content | ||
| 142 | shell: pwsh | ||
| 143 | |||
| 124 | - name: Create Windows Installer | 144 | - name: Create Windows Installer |
| 125 | run: | | 145 | run: | |
| 126 | & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "Build\curd-windows-build.iss" | 146 | & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "Build\curd-windows-build.iss" |
| @@ -130,15 +150,17 @@ jobs: | |||
| 130 | id: create_release | 150 | id: create_release |
| 131 | uses: softprops/action-gh-release@v1 | 151 | uses: softprops/action-gh-release@v1 |
| 132 | with: | 152 | with: |
| 133 | tag_name: "v${{ steps.bump_version.outputs.new_version }}" # Use the bumped version as tag | 153 | tag_name: "v${{ env.CURD_VERSION }}" |
| 134 | name: "Curd v${{ steps.bump_version.outputs.new_version }}" # Use new version in release name | 154 | name: "Curd v${{ env.CURD_VERSION }}" |
| 135 | draft: false | 155 | draft: false |
| 136 | prerelease: false | 156 | prerelease: false |
| 137 | generate_release_notes: true | 157 | generate_release_notes: true |
| 138 | files: | | 158 | files: | |
| 139 | Build/curd | 159 | releases/curd-${{ env.CURD_VERSION }}/linux/curd-linux-x86_64 |
| 140 | Build/curd.exe | 160 | releases/curd-${{ env.CURD_VERSION }}/macos/curd-macos-x86_64 |
| 141 | Build/macos/curd | 161 | releases/curd-${{ env.CURD_VERSION }}/macos/curd-macos-arm64 |
| 142 | Build/Output/CurdInstaller.exe | 162 | releases/curd-${{ env.CURD_VERSION }}/macos/curd-macos-universal |
| 163 | releases/curd-${{ env.CURD_VERSION }}/windows/curd-windows.exe | ||
| 164 | Build/Output/curd-windows-installer.exe | ||
| 143 | env: | 165 | env: |
| 144 | GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} | 166 | GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} |
Build/buildlinux +2 −2
| @@ -1,2 +1,2 @@ | |||
| 1 | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o curd -ldflags="-s -w" -trimpath cmd/curd/main.go | 1 | CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o curd-linux-x86_64 -ldflags="-s -w" -trimpath cmd/curd/main.go |
| 2 | upx --best --ultra-brute curd\ No newline at end of file | 2 | upx --best --ultra-brute curd-linux-x86_64\ No newline at end of file |
Build/buildmac +5 −1
| @@ -1 +1,5 @@ | |||
| 1 | CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o curd -ldflags="-s -w" -trimpath cmd/curd/main.go\ No newline at end of file | 1 | #!/bin/bash |
| 2 | |||
| 3 | ./Build/buildmac-arm64 | ||
| 4 | ./Build/buildmac-x86_64 | ||
| 5 | |||
Build/buildmac-arm64 +1 −1
| @@ -1 +1 @@ | |||
| 1 | CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o curd -ldflags="-s -w" -trimpath cmd/curd/main.go\ No newline at end of file | 1 | CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -o curd-macos-arm64 -ldflags="-s -w" -trimpath cmd/curd/main.go\ No newline at end of file |
Build/buildmac-x86_64 added +1
| @@ -0,0 +1 @@ | |||
| 1 | CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -o curd-macos-x86_64 -ldflags="-s -w" -trimpath cmd/curd/main.go\ No newline at end of file | ||
Build/buildwindows +2 −2
| @@ -1,2 +1,2 @@ | |||
| 1 | GOOS=windows GOARCH=amd64 go build -o curd.exe -ldflags "-s -w" ./cmd/curd/main.go | 1 | GOOS=windows GOARCH=amd64 go build -o curd-windows.exe -ldflags "-s -w" ./cmd/curd/main.go |
| 2 | upx --best --ultra-brute curd.exe\ No newline at end of file | 2 | upx --best --ultra-brute curd-windows.exe\ No newline at end of file |
Build/curd-windows-build.iss +6 −6
| @@ -1,10 +1,10 @@ | |||
| 1 | [Setup] | 1 | [Setup] |
| 2 | AppName=Curd Installer | 2 | AppName=Curd Installer |
| 3 | AppVersion=1.0.5 | 3 | AppVersion=1.0.8 |
| 4 | DefaultDirName={userappdata}\Curd | 4 | DefaultDirName={userappdata}\Curd |
| 5 | PrivilegesRequired=lowest | 5 | PrivilegesRequired=lowest |
| 6 | AllowNoIcons=yes | 6 | AllowNoIcons=yes |
| 7 | OutputBaseFilename=CurdInstaller | 7 | OutputBaseFilename=curd-windows-installer |
| 8 | UsePreviousAppDir=yes | 8 | UsePreviousAppDir=yes |
| 9 | Compression=lzma2 | 9 | Compression=lzma2 |
| 10 | SolidCompression=yes | 10 | SolidCompression=yes |
| @@ -15,11 +15,11 @@ Name: "desktopicon"; Description: "Create a &desktop shortcut"; GroupDescription | |||
| 15 | 15 | ||
| 16 | [Files] | 16 | [Files] |
| 17 | ; Copy the Curd executable to the install directory | 17 | ; Copy the Curd executable to the install directory |
| 18 | Source: "Z:releases/curd-1.0.5/windows/curd.exe"; DestDir: "{app}"; Flags: ignoreversion | 18 | Source: "..\releases\curd-{#SetupSetting("AppVersion")}\windows\curd-windows.exe"; DestDir: "{app}"; Flags: ignoreversion |
| 19 | Source: "Z:/home/wraient/Projects/curd/Build/mpv.exe"; DestDir: "{app}\bin"; Flags: ignoreversion | 19 | Source: "mpv\mpv.exe"; DestDir: "{app}\bin"; Flags: ignoreversion |
| 20 | 20 | ||
| 21 | [Icons] | 21 | [Icons] |
| 22 | ; Create the application icon in the Start Menu | 22 | ; Create the application icon in the Start Menu |
| 23 | Name: "{group}\Curd"; Filename: "{app}\curd.exe" | 23 | Name: "{group}\Curd"; Filename: "{app}\curd-windows.exe" |
| 24 | ; Create a desktop shortcut if the user checked the option | 24 | ; Create a desktop shortcut if the user checked the option |
| 25 | Name: "{userdesktop}\Curd"; Filename: "{app}\curd.exe"; Tasks: desktopicon | 25 | Name: "{userdesktop}\Curd"; Filename: "{app}\curd-windows.exe"; Tasks: desktopicon |
Build/release +19 −27
| @@ -10,15 +10,14 @@ installer_script="Build/curd-windows-build.iss" | |||
| 10 | 10 | ||
| 11 | # Ensure required directories exist | 11 | # Ensure required directories exist |
| 12 | mkdir -p "$windows_folder" "$linux_folder" "$macos_folder" | 12 | mkdir -p "$windows_folder" "$linux_folder" "$macos_folder" |
| 13 | mkdir -p "$windows_folder/bin" | ||
| 14 | 13 | ||
| 15 | # Build Linux binary | 14 | # Build Linux binary |
| 16 | echo "Building Linux binary..." | 15 | echo "Building Linux binary..." |
| 17 | bash Build/buildlinux | 16 | bash Build/buildlinux |
| 18 | 17 | ||
| 19 | # Move the Linux binary to the release folder | 18 | # Move the Linux binary to the release folder |
| 20 | if [ -f "curd" ]; then | 19 | if [ -f "curd-linux-x86_64" ]; then |
| 21 | mv curd "$linux_folder/curd-linux-x86_64" | 20 | mv curd-linux-x86_64 "$linux_folder" |
| 22 | else | 21 | else |
| 23 | echo "Linux build failed. Please check Build/buildlinux." | 22 | echo "Linux build failed. Please check Build/buildlinux." |
| 24 | exit 1 | 23 | exit 1 |
| @@ -27,18 +26,17 @@ fi | |||
| 27 | # Build macOS binaries | 26 | # Build macOS binaries |
| 28 | echo "Building macOS binaries..." | 27 | echo "Building macOS binaries..." |
| 29 | bash Build/buildmac | 28 | bash Build/buildmac |
| 30 | if [ -f "curd" ]; then | 29 | if [ -f "curd-macos-x86_64" ]; then |
| 31 | mv curd "$macos_folder/curd-macos-x86_64" | 30 | mv curd-macos-x86_64 "$macos_folder" |
| 32 | else | 31 | else |
| 33 | echo "macOS Intel build failed. Please check Build/buildmac." | 32 | echo "macOS x86-64 build failed. Please check Build/buildmac-x86_64." |
| 34 | exit 1 | 33 | exit 1 |
| 35 | fi | 34 | fi |
| 36 | 35 | ||
| 37 | bash Build/buildmac-arm64 | 36 | if [ -f "curd-macos-arm64" ]; then |
| 38 | if [ -f "curd" ]; then | 37 | mv curd-macos-arm64 "$macos_folder" |
| 39 | mv curd "$macos_folder/curd-macos-arm64" | ||
| 40 | else | 38 | else |
| 41 | echo "macOS ARM build failed. Please check Build/buildmac-arm64." | 39 | echo "macOS arm64 build failed. Please check Build/buildmac-arm64." |
| 42 | exit 1 | 40 | exit 1 |
| 43 | fi | 41 | fi |
| 44 | 42 | ||
| @@ -47,49 +45,43 @@ echo "Creating macOS Universal binary..." | |||
| 47 | llvm-lipo -create "$macos_folder/curd-macos-x86_64" "$macos_folder/curd-macos-arm64" -output "$macos_folder/curd-macos-universal" | 45 | llvm-lipo -create "$macos_folder/curd-macos-x86_64" "$macos_folder/curd-macos-arm64" -output "$macos_folder/curd-macos-universal" |
| 48 | # rm "$macos_folder/curd-macos-x86_64" "$macos_folder/curd-macos-arm64" | 46 | # rm "$macos_folder/curd-macos-x86_64" "$macos_folder/curd-macos-arm64" |
| 49 | 47 | ||
| 48 | if [ ! -f "$macos_folder/curd-macos-universal" ]; then | ||
| 49 | echo "macOS arm64 build failed. Please check Build/buildmac." | ||
| 50 | exit 1 | ||
| 51 | fi | ||
| 50 | 52 | ||
| 51 | # Update version in the installer script | 53 | # Update version in the installer script |
| 52 | sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script" | 54 | sed -i "s/^AppVersion=.*/AppVersion=$version/" "$installer_script" |
| 53 | 55 | ||
| 54 | # Update Source paths in the installer script | ||
| 55 | sed -i "s|Source: \".*curd.exe\"|Source: \"Z:$windows_folder/curd.exe\"|" "$installer_script" | ||
| 56 | # sed -i "s|Source: \".*mpv.exe\"|Source: \"Z:$windows_folder/mpv.exe\"|" "$installer_script" | ||
| 57 | |||
| 58 | # Build Windows binary | 56 | # Build Windows binary |
| 59 | echo "Building Windows binary..." | 57 | echo "Building Windows binary..." |
| 60 | bash Build/buildwindows | 58 | bash Build/buildwindows |
| 61 | 59 | ||
| 62 | # Uncompress mpv.exe.gz | 60 | # Uncompress mpv.exe.gz |
| 63 | echo "Uncompressing mpv.exe..." | 61 | echo "Uncompressing mpv.exe..." |
| 64 | gunzip -c Build/mpv.exe.gz > "Build/mpv.exe" | 62 | mkdir -p "Build/mpv" |
| 63 | gunzip -c Build/mpv.exe.gz > "Build/mpv/mpv.exe" | ||
| 65 | 64 | ||
| 66 | # Move the Windows binary to the release folder | 65 | # Move the Windows binary to the release folder |
| 67 | if [ -f "curd.exe" ]; then | 66 | if [ -f "curd-windows.exe" ]; then |
| 68 | mv curd.exe "$windows_folder/curd-windows.exe" | 67 | mv curd-windows.exe "$windows_folder" |
| 69 | else | 68 | else |
| 70 | echo "Windows build failed. Please check Build/buildwindows." | 69 | echo "Windows build failed. Please check Build/buildwindows." |
| 71 | exit 1 | 70 | exit 1 |
| 72 | fi | 71 | fi |
| 73 | 72 | ||
| 74 | # # Copy mpv.exe to the Windows release folder | ||
| 75 | # if [ -f "Build/mpv.exe" ]; then | ||
| 76 | # cp "Build/mpv.exe" "$windows_folder/" | ||
| 77 | # else | ||
| 78 | # echo "mpv.exe not found. Skipping copy." | ||
| 79 | # fi | ||
| 80 | |||
| 81 | # Create Windows installer with Inno Setup | 73 | # Create Windows installer with Inno Setup |
| 82 | echo "Creating Windows installer..." | 74 | echo "Creating Windows installer..." |
| 83 | wine "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "$installer_script" | 75 | wine "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "$installer_script" |
| 84 | 76 | ||
| 85 | # Move installer to the release folder | 77 | # Move installer to the release folder |
| 86 | installer_output="Build/Output/CurdInstaller.exe" # Replace with actual output location if different | 78 | installer_output="Build/Output/curd-windows-installer.exe" |
| 87 | if [ -f "$installer_output" ]; then | 79 | if [ -f "$installer_output" ]; then |
| 88 | mv "$installer_output" "$windows_folder/Curd-Windows-Installer.exe" | 80 | mv "$installer_output" "$windows_folder" |
| 89 | else | 81 | else |
| 90 | echo "Installer creation failed. Please check Inno Setup script output." | 82 | echo "Installer creation failed. Please check Inno Setup script output." |
| 91 | fi | 83 | fi |
| 92 | 84 | ||
| 93 | rm "Build/mpv.exe" | 85 | rm "Build/mpv/mpv.exe" |
| 94 | 86 | ||
| 95 | echo "Release build completed in $release_folder." | 87 | echo "Release build completed in $release_folder." |
VERSION.txt +1 −1
| @@ -1 +1 @@ | |||
| 1 | 1.0.4\ No newline at end of file | 1 | 1.0.8\ No newline at end of file |