name: Bump kdeconnect Cask on: schedule: - cron: "0 * * * *" # every hour workflow_dispatch: permissions: contents: write jobs: update-cask: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v4 with: token: ${{ secrets.GITHUB_TOKEN }} - name: Install dependencies run: sudo apt update && sudo apt install -y curl grep sed coreutils - name: Fetch latest build id: fetch run: | URL="https://cdn.kde.org/ci-builds/network/kdeconnect-kde/master/macos-arm64/" echo "Fetching from: $URL" # Fetch and parse the latest build latest=$(curl -s "$URL" | grep -o 'kdeconnect-kde-master-[0-9]\+-macos-clang-arm64\.dmg' | sort -V | tail -n1) if [ -z "$latest" ]; then echo "Error: No DMG files found" exit 1 fi echo "Latest file found: $latest" version=$(echo "$latest" | sed -n 's/.*kdeconnect-kde-master-\([0-9]\+\)-.*/\1/p') if [ -z "$version" ]; then echo "Error: Could not extract version number" exit 1 fi full_url="${URL}${latest}" echo "Version: $version" echo "URL: $full_url" # Set outputs safely { echo "version=${version}" echo "url=${full_url}" } >> "${GITHUB_OUTPUT:-/dev/null}" - name: Download .dmg and calculate SHA256 id: hash run: | url="${{ steps.fetch.outputs.url }}" echo "Downloading from: $url" if ! curl -L "$url" -o kdeconnect.dmg; then echo "Error: Failed to download DMG file" exit 1 fi if [ ! -f kdeconnect.dmg ]; then echo "Error: DMG file not found after download" exit 1 fi sha256=$(sha256sum kdeconnect.dmg | awk '{print $1}') echo "SHA256: $sha256" # Set output safely echo "sha256=$sha256" >> "${GITHUB_OUTPUT:-/dev/null}" - name: Update Cask file run: | sed -i "s/^ version \".*\"/ version \"${{ steps.fetch.outputs.version }}\"/" Casks/kdeconnect.rb sed -i "s/^ sha256 \".*\"/ sha256 \"${{ steps.hash.outputs.sha256 }}\"/" Casks/kdeconnect.rb - name: Commit and push if changed run: | git config user.name "GitHub Actions" git config user.email "actions@github.com" git add Casks/kdeconnect.rb if ! git diff --cached --quiet; then git commit -m "bump: Update kdeconnect to build ${{ steps.fetch.outputs.version }}" git push else echo "No changes to commit" fi