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