Update: Rofi Config #254
This file contains hidden or 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: CI/CD Pipeline | |
| on: | |
| push: | |
| branches: | |
| - main # Trigger on pushes to the main branch | |
| pull_request: | |
| branches: | |
| - main # Trigger on pull requests targeting the main branch | |
| workflow_dispatch: | |
| inputs: | |
| pr_number: | |
| description: 'Pull Request Number' | |
| required: false | |
| type: string | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # Fetch all history and tags | |
| ref: ${{ github.event.pull_request.head.sha || (github.event.inputs.pr_number && format('refs/pull/{0}/head', github.event.inputs.pr_number)) || github.sha }} | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.21' | |
| - name: Install Dependencies | |
| run: go mod tidy | |
| - name: Build Linux binary | |
| run: | | |
| ./Build/buildlinux | |
| mkdir -p release/linux | |
| mv curd-linux-x86_64 release/linux/ | |
| mv curd-linux-arm64 release/linux/ | |
| env: | |
| GITHUB_EVENT_NAME: ${{ github.event_name }} | |
| GITHUB_REF: ${{ github.ref }} | |
| GITHUB_EVENT_HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| COMPRESS: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'release:') }} | |
| - name: Build macOS x86_64 binary | |
| run: | | |
| ./Build/buildmac-x86_64 | |
| - name: Build macOS ARM64 binary | |
| run: | | |
| ./Build/buildmac-arm64 | |
| - name: Install LLVM | |
| run: | | |
| sudo apt-get update && sudo apt-get install -y llvm | |
| # Find the llvm-lipo command | |
| LIPO_CMD=$(find /usr/bin -name "llvm-lipo*" | head -n 1) | |
| echo "Found lipo command: $LIPO_CMD" | |
| echo "LIPO_CMD=$LIPO_CMD" >> $GITHUB_ENV | |
| - name: Create Universal macOS binary | |
| run: | | |
| ${{ env.LIPO_CMD }} -create "curd-macos-x86_64" "curd-macos-arm64" -output "curd-macos-universal" | |
| mkdir -p release/macos | |
| mv curd-macos-x86_64 release/macos | |
| mv curd-macos-arm64 release/macos | |
| mv curd-macos-universal release/macos | |
| - name: Build Windows binary (cross-compile) | |
| run: | | |
| ./Build/buildwindows | |
| mkdir -p release/windows | |
| mv curd-windows-x86_64.exe release/windows/curd-windows-x86_64.exe | |
| env: | |
| GITHUB_EVENT_NAME: ${{ github.event_name }} | |
| GITHUB_REF: ${{ github.ref }} | |
| GITHUB_EVENT_HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
| COMPRESS: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' && contains(github.event.head_commit.message, 'release:') }} | |
| - name: Upload Artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: curd-binaries | |
| path: | | |
| release/linux/curd-linux-x86_64 | |
| release/linux/curd-linux-arm64 | |
| release/macos/curd-macos-x86_64 | |
| release/macos/curd-macos-arm64 | |
| release/macos/curd-macos-universal | |
| release/windows/curd-windows-x86_64.exe | |
| retention-days: 1 | |
| if-no-files-found: error | |
| release: | |
| runs-on: windows-latest | |
| needs: build | |
| permissions: | |
| contents: write | |
| actions: read | |
| if: | | |
| github.ref == 'refs/heads/main' && | |
| github.event_name == 'push' && | |
| (contains(github.event.head_commit.message, 'release:')) | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Checkout MPV binaries | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: mpv-binaries | |
| path: mpv-temp | |
| sparse-checkout: | | |
| Build/mpv.exe.gz | |
| Build/mpv.zip | |
| - name: Setup MPV binary | |
| run: | | |
| New-Item -ItemType Directory -Force -Path "Build\mpv" | |
| if (Test-Path "mpv-temp/Build/mpv.exe.gz") { | |
| Copy-Item "mpv-temp/Build/mpv.exe.gz" "Build\mpv\mpv.exe.gz" | |
| 7z x "Build\mpv\mpv.exe.gz" -o"Build\mpv" | |
| Remove-Item "Build\mpv\mpv.exe.gz" | |
| } else { | |
| Write-Host "Warning: MPV binary not found in mpv-binaries branch, downloading from URL..." | |
| Invoke-WebRequest -Uri "https://raw.githubusercontent.com/${{ github.repository }}/main/Build/mpv.exe.gz" -OutFile "Build\mpv\mpv.exe.gz" | |
| 7z x "Build\mpv\mpv.exe.gz" -o"Build\mpv" | |
| Remove-Item "Build\mpv\mpv.exe.gz" | |
| } | |
| Remove-Item -Recurse -Force "mpv-temp" -ErrorAction SilentlyContinue | |
| shell: pwsh | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: curd-binaries | |
| path: Build | |
| - name: Organize Release Files | |
| run: | | |
| $version = Get-Content VERSION.txt | |
| echo "CURD_VERSION=$version" >> $env:GITHUB_ENV | |
| $release_dir = "releases/curd-$version" | |
| # Create directory structure | |
| New-Item -ItemType Directory -Force -Path "$release_dir/windows" | |
| New-Item -ItemType Directory -Force -Path "$release_dir/macos" | |
| New-Item -ItemType Directory -Force -Path "$release_dir/linux" | |
| # List contents of Build directory to debug | |
| Write-Host "Contents of Build directory:" | |
| Get-ChildItem -Path "Build" -Recurse | |
| # Move files to their respective directories | |
| Move-Item "Build/windows/curd-windows-x86_64.exe" "$release_dir/windows/" | |
| Move-Item "Build/macos/curd-macos-universal" "$release_dir/macos/" | |
| Move-Item "Build/macos/curd-macos-x86_64" "$release_dir/macos/" | |
| Move-Item "Build/macos/curd-macos-arm64" "$release_dir/macos/" | |
| Move-Item "Build/linux/curd-linux-x86_64" "$release_dir/linux/" | |
| Move-Item "Build/linux/curd-linux-arm64" "$release_dir/linux/" | |
| Copy-Item "Build/mpv/mpv.exe" "$release_dir/windows/" | |
| shell: pwsh | |
| - name: Update Inno Setup Script with New Version | |
| run: | | |
| $iss_path = "Build/curd-windows-build.iss" | |
| $content = Get-Content $iss_path | |
| $content = $content -replace '^AppVersion=.*', "AppVersion=$env:CURD_VERSION" | |
| Set-Content $iss_path $content | |
| shell: pwsh | |
| - name: Create Windows Installer | |
| run: | | |
| & "C:\Program Files (x86)\Inno Setup 6\ISCC.exe" "Build\curd-windows-build.iss" | |
| shell: pwsh | |
| - name: Create Release | |
| id: create_release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| tag_name: "v${{ env.CURD_VERSION }}" | |
| name: "Curd v${{ env.CURD_VERSION }}" | |
| draft: false | |
| prerelease: false | |
| generate_release_notes: true | |
| files: | | |
| releases/curd-${{ env.CURD_VERSION }}/linux/curd-linux-x86_64 | |
| releases/curd-${{ env.CURD_VERSION }}/linux/curd-linux-arm64 | |
| releases/curd-${{ env.CURD_VERSION }}/macos/curd-macos-x86_64 | |
| releases/curd-${{ env.CURD_VERSION }}/macos/curd-macos-arm64 | |
| releases/curd-${{ env.CURD_VERSION }}/macos/curd-macos-universal | |
| releases/curd-${{ env.CURD_VERSION }}/windows/curd-windows-x86_64.exe | |
| Build/Output/curd-windows-installer.exe | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACTIONS_PAT }} |