Skip to content

Commit d8938bb

Browse files
authored
Release 0.5.5
Release 0.5.5 - Added support to Homebrew 🍺
2 parents 83aae99 + 5966bc9 commit d8938bb

File tree

2 files changed

+37
-16
lines changed

2 files changed

+37
-16
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -120,43 +120,64 @@ jobs:
120120
121121
echo "sha256=$SHA256" >> $GITHUB_OUTPUT
122122
123+
- name: Checkout Homebrew tap repository
124+
uses: actions/checkout@v4
125+
with:
126+
repository: manucodin/homebrew-swift-mock-generator
127+
path: homebrew-tap
128+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
129+
fetch-depth: 0
130+
123131
- name: Update Homebrew formula
124132
run: |
125133
TAG=${{ steps.get_version.outputs.tag }}
126134
SHA256=${{ steps.sha256.outputs.sha256 }}
127-
FORMULA_FILE="homebrew-tap/swift-mock-generator.rb"
128135
129-
if [ ! -f "$FORMULA_FILE" ]; then
130-
echo "Error: Formula file not found at $FORMULA_FILE"
136+
# Copy template from main repo to homebrew tap
137+
TEMPLATE_FILE="Formula/swift-mock-generator.rb"
138+
139+
if [ ! -f "$TEMPLATE_FILE" ]; then
140+
echo "Error: Template file not found at $TEMPLATE_FILE"
131141
exit 1
132142
fi
133143
144+
# Determine where to place the formula in the tap repo
145+
if [ -d "homebrew-tap/Formula" ]; then
146+
FORMULA_FILE="homebrew-tap/Formula/swift-mock-generator.rb"
147+
else
148+
FORMULA_FILE="homebrew-tap/swift-mock-generator.rb"
149+
fi
150+
151+
# Copy template and update placeholders
152+
cp "$TEMPLATE_FILE" "$FORMULA_FILE"
134153
sed -i '' "s/VERSION_PLACEHOLDER/${TAG}/g" "$FORMULA_FILE"
135154
sed -i '' "s/SHA256_PLACEHOLDER/${SHA256}/g" "$FORMULA_FILE"
155+
156+
echo "✅ Updated formula: $FORMULA_FILE"
136157
137158
- name: Create branch and push changes
138159
run: |
160+
cd homebrew-tap
161+
139162
TAG=${{ steps.get_version.outputs.tag }}
140-
BRANCH_NAME="update-homebrew-formula-${TAG}"
163+
BRANCH_NAME="update-to-${TAG}"
164+
165+
git config user.name "github-actions[bot]"
166+
git config user.email "github-actions[bot]@users.noreply.github.com"
141167
142-
# Checkout the main branch (tags are in detached HEAD state)
143-
git checkout main || git checkout master
144-
git pull
168+
# Configure git to use the token for authentication
169+
git remote set-url origin https://x-access-token:${{ secrets.HOMEBREW_TAP_TOKEN }}@github.com/manucodin/homebrew-swift-mock-generator.git
145170
146171
# Check if there are changes
147-
if git diff --quiet homebrew-tap/swift-mock-generator.rb; then
172+
if git diff --quiet; then
148173
echo "No changes to commit"
149174
exit 0
150175
fi
151176
152177
# Create branch, commit and push
153178
git checkout -b "$BRANCH_NAME"
154-
155-
git config user.name "github-actions[bot]"
156-
git config user.email "github-actions[bot]@users.noreply.github.com"
157-
158-
git add homebrew-tap/swift-mock-generator.rb
159-
git commit -m "Update Homebrew formula to ${TAG}"
179+
git add .
180+
git commit -m "Update swift-mock-generator to ${TAG}"
160181
git push -u origin "$BRANCH_NAME"
161182
162183
echo "✅ Branch '$BRANCH_NAME' created and pushed successfully"

homebrew-tap/swift-mock-generator.rb renamed to Formula/swift-mock-generator.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ class SwiftMockGenerator < Formula
1111
sha256 "SHA256_PLACEHOLDER"
1212
license "MIT"
1313

14-
depends_on :macos, :>= :monterey
15-
depends_on xcode: ["15.0", :build]
14+
depends_on :macos => :monterey
15+
depends_on :xcode => ["15.0", :build]
1616

1717
def install
1818
system "swift", "build", "-c", "release", "--disable-sandbox"

0 commit comments

Comments
 (0)