Add install-helper.sh for one-step sudo helper install #5
Workflow file for this run
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: Release | |
| on: | |
| push: | |
| tags: ["v*"] # trigger on version tags: git tag v0.2.0 && git push --tags | |
| jobs: | |
| release: | |
| runs-on: macos-15 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract version from tag | |
| id: version | |
| run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT" | |
| - name: Build | |
| run: swift build -c release --disable-sandbox | |
| - name: Verify binaries | |
| run: | | |
| BIN=$(swift build -c release --disable-sandbox --show-bin-path) | |
| test -x "$BIN/wtop" | |
| test -x "$BIN/wtop-helper" | |
| - name: Create PR in Homebrew tap | |
| env: | |
| TAP_TOKEN: ${{ secrets.TAP_TOKEN }} | |
| GH_TOKEN: ${{ secrets.TAP_TOKEN }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| git clone https://x-access-token:${TAP_TOKEN}@github.com/abizer/homebrew-tap.git tap | |
| cd tap | |
| git checkout -b "wtop-v${VERSION}" | |
| # Update formula tag | |
| sed -i '' "s|tag: \"v[0-9]*\.[0-9]*\.[0-9]*\"|tag: \"v${VERSION}\"|" Formula/wtop.rb | |
| # Strip existing bottle block (new one built by test-bot) | |
| ruby -e ' | |
| f = File.read("Formula/wtop.rb") | |
| f.gsub!(/\n bottle do.*?end\n/m, "\n") | |
| File.write("Formula/wtop.rb", f) | |
| ' 2>/dev/null || true | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add Formula/wtop.rb | |
| git commit -m "wtop ${VERSION}" | |
| git push -u origin "wtop-v${VERSION}" | |
| gh pr create \ | |
| --repo abizer/homebrew-tap \ | |
| --base master \ | |
| --head "wtop-v${VERSION}" \ | |
| --title "wtop ${VERSION}" \ | |
| --body "Automated version bump from [abizer/wtop@v${VERSION}](https://github.com/abizer/wtop/releases/tag/v${VERSION})." |