mfc: v5.1.0 #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Bottle | |
| on: | |
| pull_request: | |
| paths: | |
| - 'Formula/*.rb' | |
| - '.github/workflows/bottle.yml' | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'Formula/*.rb' | |
| - '.github/workflows/bottle.yml' | |
| workflow_dispatch: | |
| inputs: | |
| formula: | |
| description: 'Formula to test (default: mfc)' | |
| required: false | |
| default: 'mfc' | |
| permissions: | |
| contents: write | |
| jobs: | |
| test-bot: | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-14, macos-13] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Homebrew | |
| uses: Homebrew/actions/setup-homebrew@master | |
| with: | |
| test-bot: false | |
| - name: Build and test (PR) | |
| if: github.event_name == 'pull_request' | |
| run: | | |
| brew test-bot --only-formulae --tap="$GITHUB_REPOSITORY" mfc | |
| - name: Build and test (manual dispatch) | |
| if: github.event_name == 'workflow_dispatch' | |
| run: | | |
| FORMULA="${{ github.event.inputs.formula }}" | |
| [ -z "$FORMULA" ] && FORMULA="mfc" | |
| brew test-bot --only-formulae --tap="$GITHUB_REPOSITORY" "$FORMULA" | |
| - name: Build, bottle, and publish (push to main) | |
| if: github.event_name == 'push' | |
| env: | |
| HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| brew test-bot --only-formulae --tap="$GITHUB_REPOSITORY" --publish mfc | |
| verify-install: | |
| runs-on: macos-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Use system Homebrew; no setup-homebrew action here to avoid its post-cleanup. | |
| - name: Update Homebrew | |
| run: | | |
| brew update | |
| - name: Tap and install | |
| run: | | |
| brew untap "$GITHUB_REPOSITORY" || true | |
| brew tap "$GITHUB_REPOSITORY" | |
| brew uninstall --force mfc || true | |
| for i in {1..6}; do | |
| if brew install MFlowCode/mfc/mfc; then break; fi | |
| echo "Retrying in 20s (attempt $i/6) ..." && sleep 20 | |
| done | |
| brew test MFlowCode/mfc/mfc || mfc --help | |
| - name: Cleanup tap (local) | |
| if: always() | |
| continue-on-error: true | |
| run: | | |
| brew untap "$GITHUB_REPOSITORY" || true | |
| rm -rf "/opt/homebrew/Library/Taps/mflowcode/homebrew-mfc" || true |