@@ -2,14 +2,14 @@ name: automatic-release
22on :
33 push :
44 branches :
5- - main
6- # schedule:
7- # # * is a special character in YAML so you have to quote this string
8- # - cron: '0 0 * * 6'
5+ - ' **'
6+ pull_request :
7+ workflow_dispatch :
98
109jobs :
1110 l10n :
1211 name : l10n
12+ if : github.ref == 'refs/heads/main'
1313 continue-on-error : true
1414 runs-on : ubuntu-latest
1515 steps :
@@ -379,13 +379,107 @@ jobs:
379379 - name : Upload the addon
380380 uses : actions/upload-artifact@v7
381381 with :
382- name : addon
382+ name : addon-64
383+ path : " *.nvda-addon"
384+ compression-level : 0
385+ retention-days : 1
386+
387+ build-32-bit-addon :
388+ name : build-32-bit-addon
389+ continue-on-error : false
390+ needs : [zip-rules, rust-32]
391+ runs-on : ubuntu-latest
392+ steps :
393+ - name : Checkout code
394+ uses : actions/checkout@v5
395+ # download the 32 build
396+ - name : Download 32 bit build
397+ uses : actions/download-artifact@v8
398+ with :
399+ name : libmathcat_py-32-3.11-win.zip
400+ # download the Rules dir (not part of checkout)
401+ - name : Download 32 bit build
402+ uses : actions/download-artifact@v8
403+ with :
404+ name : Rules.zip
405+ - name : Download Rules-minimized.zip
406+ uses : actions/download-artifact@v8
407+ with :
408+ name : Rules-minimized.zip
409+ # put things where they belong
410+ - name : Set up addons dir
411+ run : |
412+ unzip libmathcat_py-32-3.11-win.zip
413+ mv libmathcat_py.pyd Rules.zip addon/globalPlugins/MathCAT
414+ cd addon/globalPlugins/MathCAT
415+ sed 's/^import wx\.xrc/# import wx.xrc/' --in-place MathCATgui.py # fix wx file
416+ unzip Rules.zip
417+ rm Rules.zip
418+ # build the addon
419+ - name : Set up Python
420+ uses : actions/setup-python@v5
421+ with :
422+ python-version : 3.11 # needed for scons
423+ - name : Install scons dependencies
424+ run : |
425+ pip install scons markdown
426+ sudo apt update
427+ sudo apt install gettext
428+ - name : Sync addon version from MathCAT (prefer matching branch)
429+ shell : bash
430+ run : |
431+ if [ -n "${GITHUB_HEAD_REF:-}" ]; then
432+ REF="$GITHUB_HEAD_REF"
433+ else
434+ REF="${GITHUB_REF#refs/heads/}"
435+ fi
436+ echo "Detected ref: $REF"
437+ REMOTE=https://github.com/NSoiffer/MathCAT.git
438+
439+ if git ls-remote --heads "$REMOTE" "$REF" | grep -q "refs/heads/$REF"; then
440+ echo "Using MathCAT branch $REF to get version"
441+ VERSION=$(curl -fsSL https://raw.githubusercontent.com/NSoiffer/MathCAT/$REF/Cargo.toml \
442+ | sed -n 's/^version = "\(.*\)"/\1/p' | head -n1)
443+ else
444+ echo "No matching branch in MathCAT; using latest tag"
445+ VERSION=$(curl -fsSL https://raw.githubusercontent.com/NSoiffer/MathCAT/latest/Cargo.toml \
446+ | sed -n 's/^version = "\(.*\)"/\1/p' | head -n1)
447+ fi
448+
449+ if [ -z "$VERSION" ]; then
450+ echo "Failed to read MathCAT version" >&2
451+ exit 1
452+ fi
453+ echo "Syncing addon_version to MathCAT $VERSION"
454+ sed -i "s/\"addon_version\": \"[^\"]*\"/\"addon_version\": \"$VERSION\"/" buildVars.py
455+ - name : Update NVDA Version Constraints
456+ run : |
457+ # Adjust the version numbers for the old 32 bit NVDA version
458+ sed -i 's/"addon_name": "MathCAT"/"addon_name": "MathCAT-for-NVDA2025"/' buildVars.py
459+ sed -i 's/"addon_summary": _("MathCAT:/"addon_summary": _("MathCAT-for-NVDA2025:/' buildVars.py
460+ sed -i 's/"addon_minimumNVDAVersion": "[^"]*"/"addon_minimumNVDAVersion": "2025.1"/' buildVars.py
461+ sed -i 's/"addon_lastTestedNVDAVersion": "[^"]*"/"addon_lastTestedNVDAVersion": "2025.3"/' buildVars.py
462+ cat buildVars.py
463+ - name : Run scons to build .addon file
464+ run : |
465+ scons
466+ - name : Rename addon for 32-bit
467+ run : |
468+ for f in *.nvda-addon; do
469+ mv "$f" "${f%.nvda-addon}-32.nvda-addon"
470+ done
471+ ls -l *.nvda-addon
472+ - name : Upload the addon
473+ uses : actions/upload-artifact@v7
474+ with :
475+ name : addon-32
383476 path : " *.nvda-addon"
384477 compression-level : 0
385478 retention-days : 1
386479
387480 pre-release :
388481 name : Pre Release
482+ if : github.event_name != 'pull_request'
389483 continue-on-error : false
390484 needs : [zip-rules, rust-32, rust-64, linux-64, build-addon]
391485 runs-on : ubuntu-latest
0 commit comments