diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..b8486eb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,111 @@ +name: Extension Release + +# Build, test, package, and — only on a `vscode-v*` release tag — publish the +# VS Code / Cursor extension to the Marketplace and OpenVSX. Publishing is the +# last step and is reached only after the full test gate is green. A manual +# `workflow_dispatch` run does everything except publish (a tokenless dry run +# that uploads the .vsix as an artifact). Adapted from rac-core's pre-v0.22.5 +# extension-release.yml for the rac-editors home (per-repo battery, published +# rac from PyPI; see rac/roadmaps/rac-editors-buildout.md in rac-core). +# +# Required repository secrets for publishing: VSCE_PAT (Marketplace) and +# OVSX_PAT (OpenVSX). They are checked loudly before either publish step runs, +# so a missing secret can never cause a partial publish. The build/test/package +# steps need neither. +on: + push: + tags: + - "vscode-v*" + workflow_dispatch: + +permissions: + contents: write # attach the VSIX to the GitHub Release on tag builds + +concurrency: + group: extension-release-${{ github.ref }} + cancel-in-progress: false + +jobs: + release: + name: build · test · package · publish + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v5 + + - uses: actions/setup-node@v4 + with: + node-version: "20" + cache: npm + cache-dependency-path: vscode/package-lock.json + + # The tests and the extension shell out to a real `rac`. + - uses: actions/setup-python@v6 + with: + python-version: "3.11" + - name: Install rac + run: | + python -m pip install --upgrade pip + python -m pip install rac-core + + # ---- gate: the test battery must pass before we package ---- + - name: Install, typecheck, bundle + working-directory: vscode + run: | + npm ci + npm run check-types + npm run compile + + - name: Integration tests (@vscode/test-electron) + working-directory: vscode + env: + RAC_BIN: rac + run: xvfb-run -a npm test + + # ---- package ---- + - name: Package vsix + working-directory: vscode + run: npx @vscode/vsce package -o rac-vscode.vsix + + - name: Upload vsix artifact + uses: actions/upload-artifact@v6 + with: + name: rac-vscode-vsix + path: vscode/rac-vscode.vsix + retention-days: 14 + + # ---- publish (release tags only, after everything above is green) ---- + - name: Check publish secrets + if: startsWith(github.ref, 'refs/tags/vscode-v') + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + OVSX_PAT: ${{ secrets.OVSX_PAT }} + run: | + missing=0 + [ -n "$VSCE_PAT" ] || { echo "::error::VSCE_PAT secret is not set"; missing=1; } + [ -n "$OVSX_PAT" ] || { echo "::error::OVSX_PAT secret is not set"; missing=1; } + exit $missing + + - name: Publish to the VS Code Marketplace + if: startsWith(github.ref, 'refs/tags/vscode-v') + working-directory: vscode + env: + VSCE_PAT: ${{ secrets.VSCE_PAT }} + run: npx @vscode/vsce publish --packagePath rac-vscode.vsix --pat "$VSCE_PAT" + + - name: Publish to OpenVSX + if: startsWith(github.ref, 'refs/tags/vscode-v') + working-directory: vscode + env: + OVSX_PAT: ${{ secrets.OVSX_PAT }} + run: npx ovsx publish rac-vscode.vsix --pat "$OVSX_PAT" + + - name: Attach vsix to the GitHub Release + if: startsWith(github.ref, 'refs/tags/vscode-v') + env: + GH_TOKEN: ${{ github.token }} + run: | + gh release create "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \ + --title "$GITHUB_REF_NAME" --generate-notes \ + vscode/rac-vscode.vsix || \ + gh release upload "$GITHUB_REF_NAME" --repo "$GITHUB_REPOSITORY" \ + vscode/rac-vscode.vsix --clobber diff --git a/vscode/README.md b/vscode/README.md index 8cc735d..2052b86 100644 --- a/vscode/README.md +++ b/vscode/README.md @@ -1,18 +1,21 @@ # RAC for VS Code / Cursor -Inline validation for [RAC](../../README.md) (requirements-as-code) artifacts, -powered by the [`@itsthelore/rac-sdk`](../rac-sdk/README.md) thin client. +Inline validation for [RAC](https://github.com/itsthelore/rac-core) +(requirements-as-code) artifacts, powered by the +[`@itsthelore/rac-sdk`](https://www.npmjs.com/package/@itsthelore/rac-sdk) +thin client. Open or save a RAC artifact (a Markdown file with `schema_version` frontmatter) and validation findings appear as diagnostics — the same findings `rac validate` reports on the command line, because the extension runs `rac` rather than -reimplementing it ([ADR-063](../../rac/decisions/adr-063-non-python-clients-are-thin.md)). +reimplementing it +([ADR-063](https://github.com/itsthelore/rac-core/blob/main/rac/decisions/adr-063-non-python-clients-are-thin.md)). > Status: early (0.1.0). ## Requirements -- The `rac` CLI installed and discoverable (`pip install requirements-as-code`), +- The `rac` CLI installed and discoverable (`pip install rac-core`), or its path set in `rac.path`. ## Features @@ -72,7 +75,7 @@ Content-Security-Policy (no network, no remote code, no eval). ## Develop ```sh -npm install # links @itsthelore/rac-sdk from ../rac-sdk (build it first: cd ../rac-sdk && npm run build) +npm install # @itsthelore/rac-sdk resolves from npm npm run check-types npm run compile # esbuild → dist/extension.js ``` @@ -81,6 +84,7 @@ Then press **F5** (Run RAC Extension) to launch an Extension Development Host. ## Roadmap -Tracked in [`rac/roadmaps/future/typescript-sdk-vscode.md`](../../rac/roadmaps/future/typescript-sdk-vscode.md). -Next: relationship findings drawn at the reference site (`rac relationships` / -`rac review`), and completion for artifact IDs. +Tracked in the RAC corpus: +[`rac/roadmaps/rac-editors-buildout.md`](https://github.com/itsthelore/rac-core/blob/main/rac/roadmaps/rac-editors-buildout.md) +(this repository's build-out and first publish), alongside the delivered +v0.21.x editor series. diff --git a/vscode/package.json b/vscode/package.json index bcbe7a3..d8379ec 100644 --- a/vscode/package.json +++ b/vscode/package.json @@ -8,11 +8,11 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "https://github.com/itsthelore/rac-core.git", - "directory": "typescript/rac-vscode" + "url": "https://github.com/itsthelore/rac-editors.git", + "directory": "vscode" }, "bugs": { - "url": "https://github.com/itsthelore/rac-core/issues" + "url": "https://github.com/itsthelore/rac-editors/issues" }, "keywords": [ "rac",