|
35 | 35 | - run: node -v |
36 | 36 | - run: npm -v |
37 | 37 | - run: npm publish --provenance |
| 38 | + |
| 39 | + update-homebrew-tap: |
| 40 | + needs: publish-npm |
| 41 | + if: startsWith(github.ref, 'refs/tags/v') |
| 42 | + runs-on: ubuntu-latest |
| 43 | + permissions: |
| 44 | + contents: read |
| 45 | + env: |
| 46 | + TAP_REPO: luckfunc/homebrew-tap |
| 47 | + FORMULA_PATH: Formula/kill-port-process-cli.rb |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v5 |
| 50 | + - uses: actions/setup-node@v6 |
| 51 | + with: |
| 52 | + node-version: 24 |
| 53 | + - name: Resolve release version |
| 54 | + run: | |
| 55 | + VERSION="${GITHUB_REF_NAME#v}" |
| 56 | + echo "VERSION=$VERSION" >> "$GITHUB_ENV" |
| 57 | + echo "TARBALL_URL=https://registry.npmjs.org/kill-port-process-cli/-/kill-port-process-cli-$VERSION.tgz" >> "$GITHUB_ENV" |
| 58 | + - name: Compute tarball sha256 |
| 59 | + run: | |
| 60 | + curl -fsSL "$TARBALL_URL" -o package.tgz |
| 61 | + echo "SHA256=$(shasum -a 256 package.tgz | awk '{print $1}')" >> "$GITHUB_ENV" |
| 62 | + - name: Clone tap repository |
| 63 | + env: |
| 64 | + HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }} |
| 65 | + run: | |
| 66 | + git clone "https://x-access-token:${HOMEBREW_TAP_GITHUB_TOKEN}@github.com/${TAP_REPO}.git" ../homebrew-tap |
| 67 | + - name: Update formula |
| 68 | + run: | |
| 69 | + node scripts/update-homebrew-formula.js "../homebrew-tap/${FORMULA_PATH}" "$VERSION" "$SHA256" |
| 70 | + - name: Commit and push formula update |
| 71 | + working-directory: ../homebrew-tap |
| 72 | + run: | |
| 73 | + git config user.name "github-actions[bot]" |
| 74 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 75 | + git add "${FORMULA_PATH}" |
| 76 | + git diff --cached --quiet && exit 0 |
| 77 | + git commit -m "chore: bump kill-port-process-cli to ${VERSION}" |
| 78 | + git push origin HEAD:main |
0 commit comments