diff --git a/.github/workflows/release-solid.yml b/.github/workflows/release-solid.yml new file mode 100644 index 0000000..77538fe --- /dev/null +++ b/.github/workflows/release-solid.yml @@ -0,0 +1,93 @@ +name: release-solid + +on: + push: + tags: + - 'solid-v*' + +permissions: + contents: write + +jobs: + release: + name: Build & Publish Solid Adapter + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: '21' + + - uses: actions/setup-node@v4 + with: + node-version: '22' + registry-url: 'https://registry.npmjs.org' + + - uses: DeLaGuardo/setup-clojure@13 + with: + cli: 'latest' + + - name: Setup Babashka + run: | + curl -sLO https://raw.githubusercontent.com/babashka/babashka/master/install + chmod +x install + sudo ./install --dir /usr/local/bin + bb --version + + - run: npm ci + + - name: Build core library + run: npm run build + + - name: Derive version from tag + id: version + run: | + TAG="${GITHUB_REF_NAME}" + VERSION="${TAG#solid-v}" + echo "tag=${TAG}" >> "$GITHUB_OUTPUT" + echo "version=${VERSION}" >> "$GITHUB_OUTPUT" + + - name: Verify version matches package.json + run: | + PKG_VERSION=$(node -p "require('./adapters/solid/package.json').version") + if [ "$PKG_VERSION" != "${{ steps.version.outputs.version }}" ]; then + echo "Tag version (${{ steps.version.outputs.version }}) does not match package.json ($PKG_VERSION)" + exit 1 + fi + + - name: Generate Solid wrappers + run: bb scripts/generate_solid.bb + + - name: Check generated files are up to date + run: git diff --exit-code adapters/solid/src/ adapters/solid/package.json + + - name: Install adapter dependencies + run: cd adapters/solid && npm install + + - name: Build adapter + run: cd adapters/solid && npx tsc + + - name: Publish to npm + run: | + npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} + npm publish --workspace adapters/solid --access public + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + tag_name: ${{ steps.version.outputs.tag }} + name: "@vanelsas/baredom-solid v${{ steps.version.outputs.version }}" + body: | + Solid 1.x adapter for BareDOM web components. + + ```bash + npm install @vanelsas/baredom-solid + ``` + generate_release_notes: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/RELEASING.md b/docs/RELEASING.md index 7f6b449..2ed3fac 100644 --- a/docs/RELEASING.md +++ b/docs/RELEASING.md @@ -1,5 +1,11 @@ # Releasing a New Version +Two release tracks are independent — the **core library** (`@vanelsas/baredom`) and each **framework adapter** (`@vanelsas/baredom-{react,angular,vue,svelte,solid}`) version on their own cadence. + +All release-prep commits must land via PR — never push directly to main. + +## Core library release + When bumping the version, update **all four** locations — they must match: 1. `package.json` — `"version": "X.Y.Z"` @@ -14,4 +20,40 @@ Then: The `release.yml` workflow triggers on `v*` tags and publishes to npm, Clojars, and GitHub Releases. `pom.xml` is auto-generated by `build.clj` — do not edit it manually. -All release-prep commits must land via PR — never push directly to main. +## Adapter releases + +Each framework adapter lives under `adapters//` and has its own workflow in `.github/workflows/release-.yml`, keyed on `-v` tags: + +| Adapter | Workflow | Tag pattern | +|---------|----------|-------------| +| `@vanelsas/baredom-react` | `release-react.yml` | `react-vX.Y.Z` | +| `@vanelsas/baredom-angular` | `release-angular.yml` | `angular-vX.Y.Z` | +| `@vanelsas/baredom-vue` | `release-vue.yml` | `vue-vX.Y.Z` | +| `@vanelsas/baredom-svelte` | `release-svelte.yml` | `svelte-vX.Y.Z` | +| `@vanelsas/baredom-solid` | `release-solid.yml` | `solid-vX.Y.Z` | + +To release an adapter: + +1. Bump `adapters//package.json` → `"version": "X.Y.Z"` +2. Commit via PR +3. After merge: `git tag -vX.Y.Z && git push origin -vX.Y.Z` + +The per-adapter workflow regenerates the adapter sources, fails on `git diff` drift, builds, then `npm publish --workspace adapters/ --access public` with the repo's `NPM_TOKEN` secret. + +### First-time publish — NPM_TOKEN permission + +The first time an adapter package name is published, the `NPM_TOKEN` must have permission to **create new packages** under the `@vanelsas` scope: + +- **Automation token** (classic) → publishes any package the user owns. No extra config. +- **Granular access token** → check Permissions → Packages and scopes. Either grant scope-level `Read and write` on `@vanelsas`, or add each new package name to the token's allowlist *before* tagging. + +If the first-publish action fails with `403 Forbidden`, the token is missing permission for the new name. Fix on npmjs.com, then delete and re-push the failed tag: + +```bash +git tag -d -vX.Y.Z +git push origin :refs/tags/-vX.Y.Z +# fix token... +git tag -vX.Y.Z && git push origin -vX.Y.Z +``` + +`EOTP` means the token type is wrong (classic non-Automation token blocked by 2FA) — regenerate as Automation or Granular.