Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 43 additions & 8 deletions .github/workflows/update-macports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ jobs:
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ -n "${{ inputs.version }}" ]; then
if [ -n "${{ github.event.client_payload.version }}" ]; then
# Repository dispatch event
VERSION="${{ github.event.client_payload.version }}"
VERSION="${VERSION#v}"
elif [ -n "${{ inputs.version }}" ]; then
# Manual trigger with specified version
VERSION="${{ inputs.version }}"
VERSION="${VERSION#v}" # Remove 'v' prefix if present
Expand All @@ -37,11 +41,12 @@ jobs:
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Using version: ${VERSION}"

- name: Update Portfile
- name: Update Portfile and create PR
env:
MACPORTS_PORTS_TOKEN: ${{ secrets.MACPORTS_PORTS_TOKEN }}
GH_TOKEN: ${{ secrets.MACPORTS_PORTS_TOKEN }}
run: |
VERSION="${{ steps.version.outputs.version }}"
BRANCH_NAME="middledrag-${VERSION}"

# Download source tarball
curl -L -o source.tar.gz "https://github.com/${{ github.repository }}/archive/refs/tags/v${VERSION}.tar.gz"
Expand All @@ -55,12 +60,21 @@ jobs:
echo "SHA256: $SHA256"
echo "SIZE: $SIZE"

# Clone ports repo
git clone --depth 1 --filter=blob:none --sparse \
https://x-access-token:${MACPORTS_PORTS_TOKEN}@github.com/nullpointerdepressivedisorder/macports-ports.git
https://x-access-token:${GH_TOKEN}@github.com/NullPointerDepressiveDisorder/macports-ports.git
cd macports-ports
git sparse-checkout set sysutils/MiddleDrag

# Add upstream and fetch latest
git remote add upstream https://github.com/macports/macports-ports.git
git fetch upstream master --depth 1

# Create branch from upstream/master
git checkout -b "${BRANCH_NAME}" upstream/master

# Re-apply sparse checkout after branch switch
git sparse-checkout set sysutils/MiddleDrag

PORTFILE="sysutils/MiddleDrag/Portfile"

if [ ! -f "$PORTFILE" ]; then
Expand All @@ -82,8 +96,29 @@ jobs:

# Check if there are changes before committing
if git diff --staged --quiet; then
echo "No changes to commit"
echo "No changes to commit - Portfile already up to date"
exit 0
fi

# Commit with MacPorts convention: <portname>: <description>
git commit -m "MiddleDrag: update to ${VERSION}"

# Push to fork
git push -u origin "${BRANCH_NAME}" --force

# Check if PR already exists
EXISTING_PR=$(gh pr list --repo macports/macports-ports --head "NullPointerDepressiveDisorder:${BRANCH_NAME}" --json number --jq 'if length > 0 then .[0].number else empty end' 2>/dev/null || echo "")

if [ -n "$EXISTING_PR" ]; then
echo "PR #${EXISTING_PR} already exists, updated with latest changes"
else
git commit -m "Update MiddleDrag to ${VERSION}"
git push
# Create PR against upstream
gh pr create \
--repo macports/macports-ports \
--base master \
--head "NullPointerDepressiveDisorder:${BRANCH_NAME}" \
--title "MiddleDrag: update to ${VERSION}" \
--body "Routine version update for MiddleDrag to ${VERSION}.

Release notes: https://github.com/${{ github.repository }}/releases/tag/v${VERSION}"
fi
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ The middle mouse button your Mac trackpad is missing.
[![Swift 6.2+](https://img.shields.io/badge/Swift-6.2+-orange?logo=swift)](https://swift.org)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
[![Homebrew](https://img.shields.io/badge/Homebrew-tap-brown?logo=homebrew)](https://github.com/NullPointerDepressiveDisorder/homebrew-tap)
[![MacPorts Version](https://img.shields.io/badge/dynamic/json?logo=macports&label=macports&query=%24.version&url=https%3A%2F%2Fports.macports.org%2Fapi%2Fv1%2Fports%2Fmiddledrag%2F)](https://ports.macports.org/port/middledrag/)
[![GitHub release](https://img.shields.io/github/v/release/NullPointerDepressiveDisorder/MiddleDrag)](https://github.com/NullPointerDepressiveDisorder/MiddleDrag/releases)
[![Downloads](https://img.shields.io/github/downloads/NullPointerDepressiveDisorder/MiddleDrag/total?color=brightgreen)](https://github.com/NullPointerDepressiveDisorder/MiddleDrag/releases)
[![FOSSA Status](https://app.fossa.com/api/projects/custom%2B59309%2Fgithub.com%2FNullPointerDepressiveDisorder%2FMiddleDrag.svg?type=shield&issueType=license)](https://app.fossa.com/projects/custom%2B59309%2Fgithub.com%2FNullPointerDepressiveDisorder%2FMiddleDrag?ref=badge_shield&issueType=license)
Expand Down Expand Up @@ -72,6 +73,12 @@ brew tap nullpointerdepressivedisorder/tap
brew install --cask middledrag
```

### MacPorts

```bash
sudo port install MiddleDrag
```

### Manual Download

1. Download the latest `.pkg` installer from [Releases](https://github.com/NullPointerDepressiveDisorder/MiddleDrag/releases)
Expand Down
11 changes: 11 additions & 0 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,15 @@ <h3 class="text-lg font-bold text-white mb-4 flex items-center gap-2">
<h3 class="text-lg font-bold text-white mb-4 flex items-center gap-2">
<span
class="bg-brand-purple rounded-full w-6 h-6 flex items-center justify-center text-xs text-black">2</span>
Install via MacPorts
</h3>
<div class="bg-black/50 rounded p-4 font-mono text-sm text-brand-purple mb-6">
sudo port install middledrag
</div>

<h3 class="text-lg font-bold text-white mb-4 flex items-center gap-2">
<span
class="bg-brand-purple rounded-full w-6 h-6 flex items-center justify-center text-xs text-black">3</span>
Grant Permissions
</h3>
<p class="text-dark-muted mb-2">Like all gesture apps on macOS, MiddleDrag needs Accessibility
Expand Down Expand Up @@ -311,6 +320,8 @@ <h3 class="text-lg font-bold text-white mb-4 flex items-center gap-2">
<div class="flex gap-6">
<a href="https://github.com/NullPointerDepressiveDisorder/MiddleDrag"
class="text-dark-muted hover:text-brand-purple transition-colors">GitHub</a>
<a href="https://ports.macports.org/port/middledrag/"
class="text-dark-muted hover:text-brand-purple transition-colors">MacPorts</a>
<a href="https://github.com/NullPointerDepressiveDisorder/MiddleDrag/issues"
class="text-dark-muted hover:text-brand-purple transition-colors">Report Issue</a>
</div>
Expand Down
Loading