Skip to content

Commit 79ce83c

Browse files
Refactor/history cleanup (#111)
* Move appcast to dedicated branch * Refactor: Inline version bumping and streamline release process in CI workflow * Move site to gh-pages branch * Quick fixes
1 parent 4787244 commit 79ce83c

13 files changed

Lines changed: 31 additions & 2735 deletions

File tree

.github/workflows/_get-version.yml

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,38 +81,44 @@ jobs:
8181
PROJECT_VERSION=$(sed -nE 's/.*MARKETING_VERSION = ([0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?);.*/\1/p' MiddleDrag.xcodeproj/project.pbxproj | head -n 1)
8282
8383
if [ "$VERSION" != "$PROJECT_VERSION" ]; then
84-
echo "Version mismatch ($PROJECT_VERSION vs $VERSION). Bumping..."
84+
echo "Version mismatch ($PROJECT_VERSION vs $VERSION). Bumping on releases branch..."
8585
echo "kill-pipeline=true" >> $GITHUB_OUTPUT
8686
87-
# Determine the branch to update
88-
if [[ "$GITHUB_REF" == refs/heads/* ]]; then
89-
BRANCH_NAME=${GITHUB_REF#refs/heads/}
90-
else
91-
BRANCH_NAME="main"
92-
echo "Tag push detected, using $BRANCH_NAME"
93-
fi
87+
# Create a detached release commit based on current main content
88+
git checkout --detach HEAD
9489
95-
git fetch origin "$BRANCH_NAME"
96-
git checkout -b "version-bump-$VERSION"
90+
# Bump version inline (replaces bump-version.sh for CI)
91+
sed -i '' -E "s/MARKETING_VERSION = [0-9]+\.[0-9]+\.[0-9]+(\.[0-9]+)?/MARKETING_VERSION = $VERSION/g" \
92+
MiddleDrag.xcodeproj/project.pbxproj
9793
98-
NOTES="${{ inputs.notes }}"
99-
./bump-version.sh "$VERSION" "$NOTES"
94+
COUNT=$(grep -c "MARKETING_VERSION = $VERSION" MiddleDrag.xcodeproj/project.pbxproj || echo "0")
95+
if [ "$COUNT" -ne 2 ]; then
96+
echo "Error: Expected exactly 2 MARKETING_VERSION updates, found $COUNT"
97+
exit 1
98+
fi
10099
101-
# Rebase on latest main in case of new commits
102-
git fetch origin "$BRANCH_NAME"
103-
git rebase "origin/$BRANCH_NAME"
100+
git add MiddleDrag.xcodeproj/project.pbxproj
101+
git commit -m "Release v$VERSION"
104102
105-
# Update main branch to point to new commit
106-
git checkout "$BRANCH_NAME"
107-
git reset --hard "version-bump-$VERSION"
103+
NEW_SHA=$(git rev-parse HEAD)
108104
109-
# Re-create the tag to point to HEAD after rebase
110-
git tag -f -a "v$VERSION" -m "$(git tag -l --format='%(contents)' "v$VERSION" 2>/dev/null || echo "Release v$VERSION")"
105+
# Point the releases branch at this commit
106+
git branch -f releases HEAD
107+
git push origin releases --force
111108
112-
git push origin "$BRANCH_NAME" --force-with-lease
109+
# Re-create the tag to point to the release commit
110+
NOTES="${{ inputs.notes }}"
111+
TAG_MSG=$(git tag -l --format='%(contents)' "v$VERSION" 2>/dev/null || echo "")
112+
if [ -n "$NOTES" ]; then
113+
TAG_MSG="$NOTES"
114+
elif [ -z "$TAG_MSG" ]; then
115+
TAG_MSG="Release v$VERSION"
116+
fi
117+
git tag -f -a "v$VERSION" -m "$TAG_MSG"
113118
git push origin "v$VERSION" --force
114119
115-
echo "NEW_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
120+
echo "NEW_SHA=$NEW_SHA" >> $GITHUB_OUTPUT
121+
echo "✓ Release commit created on 'releases' branch (main untouched)"
116122
else
117123
echo "Version matches. Proceeding..."
118124
echo "NEW_SHA=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT

.github/workflows/deploy-site.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: Deploy Website
22

33
on:
44
push:
5-
branches: ["main", "webpage"] # Targeting current working branches
5+
branches: ["gh-pages"] # Targeting current working branches
66
workflow_dispatch:
77

88
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages

.github/workflows/update-appcast.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ jobs:
2929
uses: actions/checkout@v4
3030
with:
3131
token: ${{ steps.app-token.outputs.token }}
32+
ref: appcast
3233

3334
- name: Determine version
3435
id: version

MiddleDrag/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
<key>NSPrincipalClass</key>
3232
<string>NSApplication</string>
3333
<key>SUFeedURL</key>
34-
<string>https://raw.githubusercontent.com/nullpointerdepressivedisorder/MiddleDrag/main/appcast.xml</string>
34+
<string>https://raw.githubusercontent.com/nullpointerdepressivedisorder/MiddleDrag/appcast/appcast.xml</string>
3535
<key>SUPublicEDKey</key>
3636
<string>$(SPARKLE_PUBLIC_KEY)</string>
3737
</dict>

0 commit comments

Comments
 (0)