Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Publishes the package to GitHub Packages (npm.pkg.github.com) whenever the
# release workflow pushes a semver tag — the tagged commit already carries the
# matching package.json version. workflow_dispatch allows re-publishing a tag
# by hand (run it from the tag's ref).
name: "Release: Publish to GitHub Packages"

on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
publish:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:

- name: Checkout source
uses: actions/checkout@v6

- name: Set up Node.js
uses: actions/setup-node@v6
with:
node-version-file: '.nvmrc'
registry-url: 'https://npm.pkg.github.com'

# --ignore-scripts skips the husky prepare hook, which has no place in
# CI. The allow-directory override is scoped to this step: npm 11.16's
# pack trips the repo's allow-directory policy on the root project
# itself even though no directory dependency exists. There is
# deliberately no .npmignore: the tarball must match what the git
# dependency delivered — the committed vendor/ toolchain included —
# so the default pack rules apply. The tarball is ~59 MB.
- name: Publish
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm_config_allow_directory: all
run: npm publish --ignore-scripts
29 changes: 23 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @bsu/wp-coding-standards
# wp-coding-standards

PHP tool binaries for BSU WordPress development. Installed via npm, ships the following tools in `vendor/bin/`:

Expand All @@ -8,16 +8,33 @@ PHP tool binaries for BSU WordPress development. Installed via npm, ships the fo
| `phpcbf` | 4.x | PHP Code Beautifier — auto-fixes PHPCS violations |
| `phpstan` | 1.x | PHPStan — static analysis for type safety and correctness |

## Usage in bsuwp
## Consuming the Package

These binaries are referenced directly by path in `bsuwp/package.json` scripts:
Published to GitHub Packages as `@bemidjistate/wp-coding-standards` and
consumed under the `@bsu/wp-coding-standards` alias, so script paths keep the
short name:

```json
"@bsu/wp-coding-standards": "npm:@bemidjistate/wp-coding-standards@3.4.4"
```

The consumer's `.npmrc` routes the scope to GitHub Packages
(`@bemidjistate:registry=https://npm.pkg.github.com`); installing requires a
GitHub personal access token (classic) with `read:packages` in `~/.npmrc`,
and CI uses its workflow `GITHUB_TOKEN` via the package's Actions access list.

Consumers reference the binaries directly by path in `package.json` scripts:

```bash
npm run lint:php # phpcs via this package
npm run fix:php # phpcbf via this package
npm run analyse:php # phpstan via this package
node_modules/@bsu/wp-coding-standards/vendor/bin/phpcs
node_modules/@bsu/wp-coding-standards/vendor/bin/phpcbf
node_modules/@bsu/wp-coding-standards/vendor/bin/phpstan
```

There is deliberately no `.npmignore`: the published tarball carries the
committed `vendor/` toolchain — the same content the git dependency
delivered.

## Updating

To update tool versions, modify `composer.json` and run `composer update`, then commit the updated `composer.lock` and `vendor/` in a PR to `release`.
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@bsu/wp-coding-standards",
"version": "3.4.0",
"name": "@bemidjistate/wp-coding-standards",
"version": "3.4.4",
"description": "PHP tool binaries for BSU WordPress development \u2014 ships PHPCS, WPCS, PHPStan, and PHPUnit",
"author": "BSU|NTC Web Services",
"license": "Copyright Web Services, Bemidji State University - All Rights Reserved. Unauthorized copying of any files or code in this package, via any medium is strictly prohibited.",
Expand All @@ -9,6 +9,9 @@
"url": "git+https://github.com/BemidjiState/wp-coding-standards.git"
},
"homepage": "https://www.bemidjistate.edu",
"publishConfig": {
"registry": "https://npm.pkg.github.com"
},
"engines": {
"node": ">=24.12",
"npm": ">=11.10"
Expand Down