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
50 changes: 28 additions & 22 deletions .github/workflows/_get-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,38 +81,44 @@ jobs:
PROJECT_VERSION=$(sed -nE 's/.*MARKETING_VERSION = ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?);.*/\1/p' MiddleDrag.xcodeproj/project.pbxproj | head -n 1)

if [ "$VERSION" != "$PROJECT_VERSION" ]; then
echo "Version mismatch ($PROJECT_VERSION vs $VERSION). Bumping..."
echo "Version mismatch ($PROJECT_VERSION vs $VERSION). Bumping on releases branch..."
echo "kill-pipeline=true" >> $GITHUB_OUTPUT

# Determine the branch to update
if [[ "$GITHUB_REF" == refs/heads/* ]]; then
BRANCH_NAME=${GITHUB_REF#refs/heads/}
else
BRANCH_NAME="main"
echo "Tag push detected, using $BRANCH_NAME"
fi
# Create a detached release commit based on current main content
git checkout --detach HEAD

git fetch origin "$BRANCH_NAME"
git checkout -b "version-bump-$VERSION"
# Bump version inline (replaces bump-version.sh for CI)
sed -i '' -E "s/MARKETING_VERSION = [0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?/MARKETING_VERSION = $VERSION/g" \
MiddleDrag.xcodeproj/project.pbxproj

NOTES="${{ inputs.notes }}"
./bump-version.sh "$VERSION" "$NOTES"
COUNT=$(grep -c "MARKETING_VERSION = $VERSION" MiddleDrag.xcodeproj/project.pbxproj || echo "0")
if [ "$COUNT" -ne 2 ]; then
echo "Error: Expected exactly 2 MARKETING_VERSION updates, found $COUNT"
exit 1
fi

# Rebase on latest main in case of new commits
git fetch origin "$BRANCH_NAME"
git rebase "origin/$BRANCH_NAME"
git add MiddleDrag.xcodeproj/project.pbxproj
git commit -m "Release v$VERSION"

# Update main branch to point to new commit
git checkout "$BRANCH_NAME"
git reset --hard "version-bump-$VERSION"
NEW_SHA=$(git rev-parse HEAD)

# Re-create the tag to point to HEAD after rebase
git tag -f -a "v$VERSION" -m "$(git tag -l --format='%(contents)' "v$VERSION" 2>/dev/null || echo "Release v$VERSION")"
# Point the releases branch at this commit
git branch -f releases HEAD
git push origin releases --force

git push origin "$BRANCH_NAME" --force-with-lease
# Re-create the tag to point to the release commit
Comment on lines +105 to +109
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workflow force-pushes the releases branch (and later the version tag) without any concurrency guard. If two release runs overlap, they can race and move releases/vX.Y.Z unexpectedly. Consider adding a concurrency group to the release workflow and/or using --force-with-lease to reduce the chance of clobbering another run’s updates.

Copilot uses AI. Check for mistakes.
NOTES="${{ inputs.notes }}"
TAG_MSG=$(git tag -l --format='%(contents)' "v$VERSION" 2>/dev/null || echo "")
if [ -n "$NOTES" ]; then
TAG_MSG="$NOTES"
elif [ -z "$TAG_MSG" ]; then
TAG_MSG="Release v$VERSION"
fi
git tag -f -a "v$VERSION" -m "$TAG_MSG"
git push origin "v$VERSION" --force

echo "NEW_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
echo "NEW_SHA=$NEW_SHA" >> $GITHUB_OUTPUT
echo "✓ Release commit created on 'releases' branch (main untouched)"
else
echo "Version matches. Proceeding..."
echo "NEW_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Deploy Website

on:
push:
branches: ["main", "webpage"] # Targeting current working branches
branches: ["gh-pages"] # Targeting current working branches
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update-appcast.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ jobs:
uses: actions/checkout@v4
with:
token: ${{ steps.app-token.outputs.token }}
ref: appcast

- name: Determine version
id: version
Expand Down
2 changes: 1 addition & 1 deletion MiddleDrag/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>SUFeedURL</key>
<string>https://raw.githubusercontent.com/nullpointerdepressivedisorder/MiddleDrag/main/appcast.xml</string>
<string>https://raw.githubusercontent.com/nullpointerdepressivedisorder/MiddleDrag/appcast/appcast.xml</string>
<key>SUPublicEDKey</key>
<string>$(SPARKLE_PUBLIC_KEY)</string>
</dict>
Expand Down
Loading