Skip to content

Commit 980ceb0

Browse files
committed
Add GitHub workflows provided by the community, to be adapted later if needed
1 parent 8245b01 commit 980ceb0

File tree

5 files changed

+182
-0
lines changed

5 files changed

+182
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: pre-release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
schedule:
8+
# * is a special character in YAML so you have to quote this string
9+
- cron: '0 0 * * 6'
10+
11+
jobs:
12+
pre-release:
13+
uses: nvdaes/nvdaAddonWorkflows/.github/workflows/automaticRelease.yaml@main
14+
permissions:
15+
contents: write
16+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Check that we dont have extended ascii or utf boms in our files
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
extendedAsciiAndBom:
8+
uses: nvdaes/nvdaAddonWorkflows/.github/workflows/check-for-extended-ascii-and-utf-bom.yaml@main
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Check that all translatable strings have translators comments
2+
3+
on:
4+
push:
5+
# Run this workflow if push tag or in master branch
6+
tags: ["*"]
7+
branches: [ main , master ]
8+
pull_request:
9+
branches:
10+
- main
11+
workflow_dispatch:
12+
13+
jobs:
14+
buildPotFileAndCheckTranslatorsComments:
15+
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- name: Checkout code
20+
uses: actions/checkout@v3
21+
22+
- name: Set up Python 3.8
23+
uses: actions/setup-python@v4
24+
with:
25+
python-version: 3.8
26+
27+
- name: Install dependencies
28+
run: |
29+
pip install scons markdown
30+
sudo apt update
31+
sudo apt install gettext
32+
33+
- name: Generate the .pot file
34+
run: scons pot
35+
36+
- name: Download NVDA's checkPot.py
37+
run: curl https://raw.githubusercontent.com/nvaccess/nvda/master/tests/checkPot.py -O
38+
39+
- name: Run checkPot
40+
id: runCheckPot
41+
#run: |
42+
# from . import checkPot
43+
# checkPot.EXPECTED_MESSAGES_WITHOUT_COMMENTS = set()
44+
# res = checkPot.checkPot('$(ls *.pot)')
45+
# exit(res)
46+
#shell: python
47+
run: |
48+
python -c "import checkPot;checkPot.EXPECTED_MESSAGES_WITHOUT_COMMENTS = set();exit(checkPot.checkPot('$(ls *.pot)'))"
49+
echo "nb_errors=$?" >> "$GITHUB_OUTPUT"
50+
51+
- name: Notify
52+
run: |
53+
if [[ ${{ steps.runCheckPot.outputs.nb_errors }} == 0 ]];
54+
then
55+
echo "Translators comments: PASS"
56+
exit 0;
57+
else
58+
echo "Translators comments: FAIL"
59+
exit 1;
60+
fi
61+

.github/workflows/lint.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: Lint
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
13+
lint:
14+
uses: nvdaes/nvdaAddonWorkflows/.github/workflows/lint.yaml@main
15+
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Manual release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Add-on version'
8+
required: true
9+
default: '0.0.0'
10+
prerelease:
11+
description: 'Mark as prerelease on GitHub'
12+
default: false
13+
type: boolean
14+
signAddOn:
15+
description: 'Sign add-on with GPG'
16+
default: true
17+
type: boolean
18+
19+
jobs:
20+
buildAndUpload:
21+
continue-on-error: true
22+
runs-on: ubuntu-latest
23+
24+
permissions:
25+
contents: write
26+
27+
steps:
28+
- id: checkoutCode
29+
name: Checkout code
30+
uses: actions/checkout@v3
31+
- name: Set up Python 3.8
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: 3.8
35+
- name: Install dependencies
36+
run: |
37+
pip install scons markdown
38+
sudo apt update
39+
sudo apt install gettext
40+
- name: Add add-on version
41+
run: |
42+
import re
43+
with open("buildVars.py", 'r+', encoding='utf-8') as f:
44+
text = f.read()
45+
version = "${{ github.event.inputs.version }}"
46+
text = re.sub(r"\"addon_version\": .*?,", f"\"addon_version\": \"{version}\",", text)
47+
f.seek(0)
48+
f.write(text)
49+
f.truncate()
50+
shell: python
51+
- name: Build add-on
52+
run: scons
53+
- name: Push changes
54+
run: |
55+
git config --global user.name github-actions
56+
git config --global user.email github-actions@github.com
57+
git commit -a -m "Update buildVars"
58+
git push origin HEAD:main
59+
- id: import_gpg
60+
if: ${{ inputs.signAddOn }}
61+
name: Import GPG key
62+
uses: crazy-max/ghaction-import-gpg@v5
63+
with:
64+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
65+
passphrase: ${{ secrets.PASSPHRASE }}
66+
- if: ${{ inputs.signAddOn }}
67+
name: Sign add-on
68+
run: gpg --detach-sign *.nvda-addon
69+
- name: Calculate sha256
70+
run: sha256sum *.nvda-addon >> sha256.txt
71+
- name: Create tag
72+
run: |
73+
git tag ${{ inputs.version }}
74+
git push origin ${{ inputs.version }}
75+
- name: Release
76+
uses: ncipollo/release-action@v1
77+
with:
78+
tag: ${{ inputs.version }}
79+
artifacts: "*.nvda-addon,*.sig,publicKey.asc,sha256.txt"
80+
generateReleaseNotes: true
81+
prerelease: ${{ inputs.prerelease }}
82+

0 commit comments

Comments
 (0)