Skip to content

Commit 3f2493b

Browse files
committed
deploy to repo
1 parent e45bd02 commit 3f2493b

File tree

3 files changed

+171
-6
lines changed

3 files changed

+171
-6
lines changed
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Test Tap Deployment (Fork)
2+
3+
on:
4+
push:
5+
branches:
6+
- '**' # Run on any branch
7+
paths:
8+
- 'packaging/homebrew/mfc.rb'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read # Only read for testing
13+
14+
jobs:
15+
test-deploy:
16+
name: Test Formula Deployment
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout MFC repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Validate formula syntax
25+
run: |
26+
echo "Validating formula syntax..."
27+
# This will work if you have brew installed, otherwise just check file exists
28+
if [ -f packaging/homebrew/mfc.rb ]; then
29+
echo "✅ Formula file exists"
30+
echo "File size: $(wc -l < packaging/homebrew/mfc.rb) lines"
31+
else
32+
echo "❌ Formula file not found"
33+
exit 1
34+
fi
35+
36+
- name: Check tap repository (dry run)
37+
run: |
38+
echo "Checking if tap repository is accessible..."
39+
# Just check if we can access the repo (won't push)
40+
echo "Would deploy to: MFlowCode/homebrew-mfc"
41+
echo "Source commit: ${{ github.sha }}"
42+
echo "Source branch: ${{ github.ref_name }}"
43+
echo "Source repo: ${{ github.repository }}"
44+
45+
- name: Simulate deployment
46+
run: |
47+
echo "📦 Simulated deployment steps:"
48+
echo "1. ✅ Checkout MFC repository"
49+
echo "2. ✅ Validate formula syntax"
50+
echo "3. ⏭️ Would checkout tap repository"
51+
echo "4. ⏭️ Would copy formula to tap-repo/Formula/mfc.rb"
52+
echo "5. ⏭️ Would commit and push changes"
53+
echo ""
54+
echo "✅ All checks passed! Ready for real deployment."
55+

.github/workflows/deploy-tap.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Deploy to Homebrew Tap
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- 'packaging/homebrew/mfc.rb'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
deploy-tap:
16+
name: Deploy Formula to Tap
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout MFC repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Checkout tap repository
25+
uses: actions/checkout@v4
26+
with:
27+
repository: MFlowCode/homebrew-mfc
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
path: tap-repo
30+
31+
- name: Setup Git
32+
run: |
33+
git config --global user.name "github-actions[bot]"
34+
git config --global user.email "github-actions[bot]@users.noreply.github.com"
35+
36+
- name: Copy formula to tap
37+
run: |
38+
mkdir -p tap-repo/Formula
39+
cp packaging/homebrew/mfc.rb tap-repo/Formula/mfc.rb
40+
41+
- name: Check for changes
42+
id: check-changes
43+
run: |
44+
cd tap-repo
45+
if git ls-files --error-unmatch Formula/mfc.rb >/dev/null 2>&1; then
46+
# File exists in repo, check if it changed
47+
if git diff --quiet HEAD -- Formula/mfc.rb; then
48+
echo "changed=false" >> $GITHUB_OUTPUT
49+
else
50+
echo "changed=true" >> $GITHUB_OUTPUT
51+
fi
52+
else
53+
# File doesn't exist in repo, it's a new file
54+
echo "changed=true" >> $GITHUB_OUTPUT
55+
fi
56+
57+
- name: Commit and push to tap
58+
if: steps.check-changes.outputs.changed == 'true'
59+
run: |
60+
cd tap-repo
61+
git add Formula/mfc.rb
62+
git commit -m "Update mfc formula from MFC repository
63+
64+
Auto-deployed from MFlowCode/MFC@${{ github.sha }}"
65+
git push
66+
67+
- name: No changes detected
68+
if: steps.check-changes.outputs.changed == 'false'
69+
run: |
70+
echo "No changes detected in formula. Skipping deployment."
71+

packaging/homebrew/HOMEBREW.md

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ Once the formula is accepted into `homebrew-core`, install with:
2626
brew install mfc
2727
```
2828

29-
#### Option 2: Third-Party Tap
29+
#### Option 2: Third-Party Tap (Recommended)
3030

31-
If the formula is available in a tap repository:
31+
Install from the official MFC Homebrew tap:
3232

3333
```bash
3434
# Add the tap
@@ -38,6 +38,8 @@ brew tap MFlowCode/mfc
3838
brew install MFlowCode/mfc/mfc
3939
```
4040

41+
The tap is automatically kept up-to-date with the latest formula changes.
42+
4143
#### Option 3: Install from Local Formula File
4244

4345
If you have the formula file locally (e.g., from cloning the MFC repository):
@@ -101,6 +103,26 @@ mfc run case.py
101103
mfc run $(brew --prefix mfc)/examples/1D_sodshocktube/case.py
102104
```
103105

106+
### Uninstallation
107+
108+
To remove MFC from your system:
109+
110+
```bash
111+
# Uninstall MFC
112+
brew uninstall mfc
113+
114+
# If installed from a tap, you may also want to remove the tap
115+
brew untap MFlowCode/mfc # Replace with your tap name if different
116+
```
117+
118+
**Note**: Uninstalling MFC will remove:
119+
- All MFC binaries (`mfc`, `pre_process`, `simulation`, `post_process`)
120+
- The Python virtual environment and toolchain
121+
- Example cases
122+
- All associated files
123+
124+
The uninstallation is clean and complete - Homebrew will remove all files that were installed by the formula.
125+
104126
## What Gets Installed
105127

106128
When users run `brew install mfc`, they get:
@@ -341,6 +363,12 @@ brew reinstall mfc
341363

342364
# View installation logs
343365
brew install --verbose mfc
366+
367+
# Uninstall MFC
368+
brew uninstall mfc
369+
370+
# Remove tap (if installed from a tap)
371+
brew untap MFlowCode/mfc
344372
```
345373

346374
**Note**: The `brew --prefix mfc` command returns the "opt" symlink location (e.g., `/usr/local/opt/mfc` or `/opt/homebrew/opt/mfc`), not the actual versioned Cellar path. The "opt" directory points to the currently active version in the Cellar, making examples work on both Intel and Apple Silicon systems. If you need the actual versioned installation path, look in the Cellar directory (e.g., `/usr/local/Cellar/mfc/VERSION`).
@@ -357,13 +385,24 @@ Submit a pull request to homebrew-core for inclusion in the main Homebrew reposi
357385
- Automated testing passes
358386

359387
### Third-Party Tap
360-
Create a separate tap (custom repository) for immediate availability:
388+
389+
MFC maintains an official Homebrew tap at `MFlowCode/homebrew-mfc` for easy installation:
390+
361391
```bash
362-
brew tap organization/mfc
363-
brew install organization/mfc/mfc
392+
# Add the tap
393+
brew tap MFlowCode/mfc
394+
395+
# Install MFC
396+
brew install MFlowCode/mfc/mfc
364397
```
365398

366-
This allows distribution before official Homebrew acceptance.
399+
The tap is automatically updated whenever the formula changes in the main MFC repository. This allows distribution before official Homebrew acceptance and provides a convenient installation method for users.
400+
401+
**Tap Repository**: https://github.com/MFlowCode/homebrew-mfc
402+
403+
The tap repository contains:
404+
- `Formula/mfc.rb` - The Homebrew formula file (automatically synced from the main repository)
405+
- Automatic deployment via GitHub Actions when the formula is updated
367406

368407
## Platform Support
369408

0 commit comments

Comments
 (0)