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
49 changes: 31 additions & 18 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ name: Addon-release

on:
push:
tags:
- "v*"
branches: [master]
tags: ["v*"]
pull_request:
workflow_dispatch:

jobs:
release:
Expand All @@ -14,43 +16,54 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v10
with:
python-version: 3.11
cache: "pip"
enable-cache: true
python-version: "3.13"

- name: Install dependencies
run: |
pip install scons markdown
sudo apt update
sudo apt install gettext
run: uv sync

- name: Lint
run: uv run ruff check addon

- name: Validate addon.toml
run: uv run nvaddon check

- name: Build addon
run: scons
run: uv run nvaddon build

- name: Upload release
id: release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
tag_name: ${{ github.ref_name }}
files: |
*.nvda-addon
generate_release_notes: true
prerelease: false
prerelease: ${{ !endsWith(github.ref, '-stable') }}

- name: extract addon info
if: startsWith(github.ref, 'refs/tags/')
run: |
python3 -c 'from buildVars import addon_info
env = {
"ADDON_NAME": addon_info["addon_name"],
"ADDON_VERSION": addon_info["addon_version"],
"ADDON_CHANNEL": addon_info["addon_updateChannel"],
uv run python -c '
import os, tomllib
addon = tomllib.load(open("addon.toml", "rb"))["addon"]
fields = {
"ADDON_NAME": addon["name"],
"ADDON_VERSION": addon["version"],
"ADDON_CHANNEL": addon.get("updateChannel") or "stable",
}
[print(f"{k}={v}") for k, v in env.items()]' > "$GITHUB_ENV"
with open(os.environ["GITHUB_ENV"], "a") as env:
for key, value in fields.items():
env.write(f"{key}={value}\n")
'

- name: submit addon
if: startsWith(github.ref, 'refs/tags/')
uses: beqabeqa473/submitNVDAAddon@v1
with:
addon_name: ${{ env.ADDON_NAME }}
Expand Down
9 changes: 8 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,12 @@ manifest.ini
*.pot
*.py[co]
*.nvda-addon
.sconsign.dblite
/[0-9]*.[0-9]*.[0-9]*.json

addon/manifest.ini
addon/locale/*/manifest.ini
addon/doc/*/*.html

# uv creates this locally; never commit it.
.venv/
__pycache__/
7 changes: 0 additions & 7 deletions .pre-commit-config.yaml

This file was deleted.

58 changes: 58 additions & 0 deletions addon.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# Configuration for this NVDA add-on, migrated from buildVars.py.
#
# The comment directly above a translatable string is that string's note to
# translators, and is carried into the generated .pot file.

[addon]
# add-on Name/identifier, internal for NVDA
name = "instantTranslate"
# Add-on summary, usually the user visible name of the addon.
summary = "Instant Translate "

# Add-on description
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
description = "This addon translates selected or clipboard text using Translate services and presents it to the user."

# version
version = "5.1.0"
# Author(s)
author = "Alexy Sadovoy aka Lex <[email protected]>, ruslan <[email protected]>, beqa <[email protected]>, Mesar Hameed <[email protected]>, Alberto Buffolino <[email protected]>, and other NVDA contributors"
# URL for the add-on documentation support
url = "https://github.com/addonFactory/instantTranslate"
# URL for the add-on repository where the source code can be found
sourceURL = "https://github.com/addonFactory/instantTranslate"
# Documentation file name
docFileName = "readme.html"
# Minimum NVDA version supported (e.g. "2018.3.0", minor version is optional)
minimumNVDAVersion = "2019.3.0"
# Last NVDA version supported/tested (e.g. "2018.4.0", ideally more recent than minimum version)
lastTestedNVDAVersion = "2026.1.0"
# Add-on update channel (default is None, denoting stable releases,
# and for development releases, use "dev".)
# Do not change unless you know what you are doing!
updateChannel = "stable"
# Add-on license such as GPL 2
license = "GPL v2"
# URL for the license document the ad-on is licensed under
licenseURL = "https://www.gnu.org/licenses/gpl-2.0.html"

[release]
tagPrefix = "v"

[build]
# The Python files that make up this add-on, scanned for translatable strings.
pythonSources = ["addon/globalPlugins/instantTranslate/*.py", "addon/globalPlugins/instantTranslate/translators/*.py"]

# Files inside the `addon` directory to leave out of the built add-on.
excludedFiles = []

[l10n]
# The language this add-on is written in.
baseLanguage = "en"

# Extra files to scan for translatable strings.
extraSources = []

[docs]
# Python-Markdown extensions used when rendering documentation.
markdownExtensions = []
Loading
Loading