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
91 changes: 0 additions & 91 deletions .github/workflows/publish-extension.yml

This file was deleted.

99 changes: 99 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,34 @@ on:
push:
branches:
- main
workflow_dispatch:
inputs:
release_target:
description: "What to release"
required: true
type: choice
default: "packages"
options:
- "packages"
- "vscode-extension"
extension_level:
description: "VS Code extension release level"
required: true
type: choice
default: "patch"
options:
- "patch"
- "minor"
- "major"

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
release:
name: Release
if: |
github.event_name == 'push' ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.release_target == 'packages')
runs-on: ubuntu-latest
permissions:
contents: write
Expand Down Expand Up @@ -38,3 +60,80 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_CONFIG_PROVENANCE: "true"

release-vscode-extension:
name: Release VS Code Extension
if: github.event_name == 'workflow_dispatch' && github.event.inputs.release_target == 'vscode-extension'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: "24"

- name: Install dependencies
run: npm install

- name: Set up git user
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Update schema
run: |
node ./scripts/getSchemas.js
git add packages/vscode-extension/assets/schema
git commit -m "chore(vscode-extension): update schemas" || true

- name: Bump extension version
run: |
cd packages/vscode-extension
npm version ${{ github.event.inputs.extension_level }} --no-git-tag-version

- name: Build dependency packages
run: npm run build:packages

- name: Build extension
run: npm run build -w pretext-tools

- name: Package extension
run: |
cd dist/vscode-extension
npx vsce package --no-dependencies

- name: Get extension version
id: version
run: echo "VERSION=$(jq -r '.version' packages/vscode-extension/package.json)" >> "$GITHUB_OUTPUT"

- name: Publish to VS Marketplace
run: |
cd dist/vscode-extension
npx vsce publish --no-dependencies -p "${{ secrets.VS_MARKETPLACE_TOKEN }}"

- name: Publish to Open VSX
run: |
cd dist/vscode-extension
npx ovsx publish --no-dependencies -p "${{ secrets.OPEN_VSX_TOKEN }}"

- name: Update changelog and commit release metadata
run: |
newline="\\n## [${{ steps.version.outputs.VERSION }}] - $(date +'%Y-%m-%d')"
sed '/## \[UNRELEASED\]/a\'"$newline" packages/vscode-extension/CHANGELOG.md > CHANGELOG.md.tmp
mv CHANGELOG.md.tmp packages/vscode-extension/CHANGELOG.md
git add packages/vscode-extension/CHANGELOG.md
git add packages/vscode-extension/package.json
git add package-lock.json
git commit -m "chore(vscode-extension): publish v${{ steps.version.outputs.VERSION }}" || true
git push origin main

- name: Create GitHub release for extension
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "vscode-extension-v${{ steps.version.outputs.VERSION }}" \
--repo="$GITHUB_REPOSITORY" \
--title="VS Code Extension v${{ steps.version.outputs.VERSION }}" \
--notes="See packages/vscode-extension/CHANGELOG.md for details."
4 changes: 4 additions & 0 deletions packages/vscode-extension/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [UNRELEASED]

## [0.38.0] - 2026-05-27

- Explosed the "Markdown-style PreTeXt" converter as one of the two conversion options.

## [0.37.0] - 2026-05-25

### Changed
Expand Down
95 changes: 58 additions & 37 deletions packages/vscode-extension/assets/schema/pretext-dev.rng
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,17 @@
<attribute name="calcplot3d"/>
</optional>
<optional>
<attribute name="variant"/>
<!--
currently only consumed by the CalcPlot3D flavor;
widen this enum if another flavor adopts "@variant"
-->
<attribute name="variant">
<choice>
<value>application</value>
<value>controls</value>
<value>minimal</value>
</choice>
</attribute>
</optional>
<optional>
<attribute name="dark-mode-enabled"/>
Expand Down Expand Up @@ -521,9 +531,14 @@
</choice>
</attribute>
</optional>
<oneOrMore>
<ref name="Block"/>
</oneOrMore>
<choice>
<oneOrMore>
<ref name="BlockOrdered"/>
</oneOrMore>
<oneOrMore>
<ref name="BlockUnordered"/>
</oneOrMore>
</choice>
</element>
<zeroOrMore>
<ref name="Hint"/>
Expand Down Expand Up @@ -554,15 +569,30 @@
</optional>
</optional>
</define>
<define name="Block">
<element name="block">
<optional>
<attribute name="order">
<data type="integer"/>
</attribute>
</optional>
<choice>
<group>
<define name="BlockBody">
<choice>
<group>
<optional>
<attribute name="correct">
<choice>
<value>yes</value>
<value>no</value>
</choice>
</attribute>
</optional>
<oneOrMore>
<mixed>
<optional>
<ref name="BlockText"/>
</optional>
<optional>
<ref name="CodeLine"/>
</optional>
</mixed>
</oneOrMore>
</group>
<oneOrMore>
<element name="choice">
<optional>
<attribute name="correct">
<choice>
Expand All @@ -581,30 +611,21 @@
</optional>
</mixed>
</oneOrMore>
</group>
<oneOrMore>
<element name="choice">
<optional>
<attribute name="correct">
<choice>
<value>yes</value>
<value>no</value>
</choice>
</attribute>
</optional>
<oneOrMore>
<mixed>
<optional>
<ref name="BlockText"/>
</optional>
<optional>
<ref name="CodeLine"/>
</optional>
</mixed>
</oneOrMore>
</element>
</oneOrMore>
</choice>
</element>
</oneOrMore>
</choice>
</define>
<define name="BlockOrdered">
<element name="block">
<attribute name="order">
<data type="integer"/>
</attribute>
<ref name="BlockBody"/>
</element>
</define>
<define name="BlockUnordered">
<element name="block">
<ref name="BlockBody"/>
</element>
</define>
<define name="Matching">
Expand Down
Loading