Skip to content

Commit

Permalink
version 23.5.2
Browse files Browse the repository at this point in the history
added a script to update version in the buildVars.py automatically if it as not been changed but is confirmed in a commit. this can be used manually, or automatically with a post commit hook.
updated sconstruct to generate the required json file for the add-on store. Currently this add-on is not in the add-on store, but I prefer to use the same workflow for all my add-ons.
updated buildVars to be compatible with the new sconstruct.
now *.json files are ignored.
fix the update function to check for the correct asset first, in case of more than one asset in the release.
  • Loading branch information
davidacm committed May 2, 2023
1 parent abfea4e commit b60a7fa
Show file tree
Hide file tree
Showing 6 changed files with 263 additions and 63 deletions.
48 changes: 36 additions & 12 deletions .github/workflows/upload-on-tag.yaml
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
permissions:
contents: write
name: Upload on new tags

on:
push:
tags:
'*'
['*']
workflow_dispatch:

jobs:
buildAndUpload:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
uses: actions/checkout@v3
- run: echo -e "pre-commit\nscons\nmarkdown">requirements.txt
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.7
python-version: 3.9
cache: 'pip'

- name: Install dependencies
run: |
pip install scons markdown
sudo apt update
sudo apt install gettext
- name: Add add-on version
run: |
import re
Expand All @@ -31,16 +37,34 @@ jobs:
f.write(text)
f.truncate()
shell: python

- name: Build add-on
run: scons
- name: Calculate sha256
run: sha256sum *.nvda-addon >> changelog.md

- uses: actions/upload-artifact@v3
with:
name: packaged_addon
path: |
./*.nvda-addon
./*.json
upload_release:
runs-on: ubuntu-latest
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs: ["build"]
steps:
- uses: actions/checkout@v3
- name: download releases files
uses: actions/download-artifact@v3
- name: Display structure of downloaded files
run: ls -R

- name: Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
*.nvda-addon
body_path: changelog.md
prerelease: ${{ endsWith(github.ref, '-dev') }}
packaged_addon/*.nvda-addon
fail_on_unmatched_files: true
prerelease: ${{ contains(github.ref, '-') }}
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
addon/doc/*.css
addon/doc/en/
addon/synthDrivers/ibmtts
*_docHandler.py
*.html
*.ini
*.mo
*.py[co]
*.nvda-addon
*.code-workspace
setup.cfg
.sconsign.dblite
*.code-workspace
*.json
13 changes: 10 additions & 3 deletions addon/globalPlugins/_ibmttsUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,18 @@ def getUpdateInfo(self):
if res.code != 200:
raise RuntimeError(f"Checking for update failed with code {res.code} of url: {self.url}")
data = json.loads(res.read())
asset = None
for k in data['assets']:
if ".nvda-addon" in k['name']:
asset = k
break
if not asset:
raise RuntimeError("Unable to find the package addon file (.add-on) in the asset list")
return {
'version': data['name'],
'name': data['assets'][0]['name'],
'downloadUrl': data['assets'][0]['browser_download_url'],
'releaseDate': time.mktime(time.strptime(data['assets'][0]['updated_at'], "%Y-%m-%dT%H:%M:%SZ"))
'name': asset['name'],
'downloadUrl': asset['browser_download_url'],
'releaseDate': time.mktime(time.strptime(asset['updated_at'], "%Y-%m-%dT%H:%M:%SZ"))
}


Expand Down
19 changes: 18 additions & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description" : _("""This is the IBMTTS synthesizer driver for NVDA."""),
# version
"addon_version" : "v23.02.1",
"addon_version" : "23.5.2",
# Author(s)
"addon_author" : u"David CM <[email protected]>, x0 and others",
# URL for the add-on documentation support
Expand All @@ -32,6 +32,12 @@
"addon_lastTestedNVDAVersion" : "2023.1.0",
# Add-on update channel (default is stable or None)
"addon_updateChannel" : None,
# Add-on license such as GPL 2
"addon_license": "GPL 2",
# URL for the license document the ad-on is licensed under
"addon_licenseURL": "https://www.gnu.org/licenses/old-licenses/gpl-2.0.html",
# URL for the add-on repository where the source code can be found
"addon_sourceURL": "https://github.com/davidacm/NVDA-IBMTTS-Driver",
}


Expand All @@ -50,3 +56,14 @@
# Files that will be ignored when building the nvda-addon file
# Paths are relative to the addon directory, not to the root directory of your addon sources.
excludedFiles = []


# Base language for the NVDA add-on
baseLanguage = "en"

# Markdown extensions for add-on documentation
# Most add-ons do not require additional Markdown extensions.
# If you need to add support for markup such as tables, fill out the below list.
# Extensions string must be of the form "markdown.extensions.extensionName"
# e.g. "markdown.extensions.tables" to add tables.
markdownExtensions = []
Loading

0 comments on commit b60a7fa

Please sign in to comment.