Skip to content

fix: harden cli port handling and add tests #32

fix: harden cli port handling and add tests

fix: harden cli port handling and add tests #32

Workflow file for this run

name: Node.js Package
on:
push:
branches: [main]
tags:
- "v*"
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24
- run: npm ci
publish-npm:
needs: build
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: node -v
- run: npm -v
- run: npm publish --provenance
update-homebrew-tap:
needs: publish-npm
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
permissions:
contents: read
env:
TAP_REPO: luckfunc/homebrew-tap
FORMULA_PATH: Formula/kill-port-process-cli.rb
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Resolve release version
run: |
VERSION="${GITHUB_REF_NAME#v}"
echo "VERSION=$VERSION" >> "$GITHUB_ENV"
echo "TARBALL_URL=https://registry.npmjs.org/kill-port-process-cli/-/kill-port-process-cli-$VERSION.tgz" >> "$GITHUB_ENV"
- name: Compute tarball sha256
run: |
curl -fsSL "$TARBALL_URL" -o package.tgz
echo "SHA256=$(shasum -a 256 package.tgz | awk '{print $1}')" >> "$GITHUB_ENV"
- name: Clone tap repository
env:
HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}
run: |
git clone "https://x-access-token:${HOMEBREW_TAP_GITHUB_TOKEN}@github.com/${TAP_REPO}.git" ../homebrew-tap
- name: Update formula
run: |
node scripts/update-homebrew-formula.js "../homebrew-tap/${FORMULA_PATH}" "$VERSION" "$SHA256"
- name: Commit and push formula update
working-directory: ../homebrew-tap
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add "${FORMULA_PATH}"
git diff --cached --quiet && exit 0
git commit -m "chore: bump kill-port-process-cli to ${VERSION}"
git push origin HEAD:main