Repository navigation
95 lines (81 loc) · 2.63 KB
/
Copy pathrelease.yml
File metadata and controls
95 lines (81 loc) · 2.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
name: Release
on:
push:
branches: [ main, master ]
tags: ["*"]
pull_request:
workflow_dispatch:
workflow_call:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repo
uses: actions/checkout@v7
- name: Install uv
uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
- name: Install dependencies
run: uv sync
- name: Lint
run: uv run ruff check addon
- name: Validate addon.toml
run: uv run nvaddon check
- name: Build add-on
run: |
uv run nvaddon build
uv run nvaddon pot
- name: Read add-on metadata
run: |
uv run python - <<'PY' >> "$GITHUB_ENV"
import tomllib
config = tomllib.load(open("addon.toml", "rb"))
addon = config["addon"]
release = config.get("release", {})
print(f"ADDON_NAME={addon['name']}")
print(f"ADDON_VERSION={addon['version']}")
print(f"ADDON_CHANNEL={addon.get('updateChannel') or 'stable'}")
print(f"ADDON_AUTO_SUBMIT={str(release.get('autoSubmit', True)).lower()}")
PY
- name: Upload add-on artifact
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v7
with:
name: packaged_addon
path: ./*.nvda-addon
archive: false
- name: Upload translation template artifact
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
uses: actions/upload-artifact@v7
with:
name: translation_template
path: ./*.pot
archive: false
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
prerelease=""
case "${{ github.ref_name }}" in
*-stable) ;;
*) prerelease="--prerelease" ;;
esac
gh release create "${{ github.ref_name }}" \
./*.nvda-addon ./*.pot \
--title "${{ github.ref_name }}" \
--generate-notes \
$prerelease
- name: Submit to the NVDA add-on store
if: ${{ startsWith(github.ref, 'refs/tags/') && env.ADDON_AUTO_SUBMIT == 'true' }}
uses: beqabeqa473/submitNVDAAddon@v1
with:
addon_name: ${{ env.ADDON_NAME }}
addon_version: ${{ env.ADDON_VERSION }}
channel: ${{ env.ADDON_CHANNEL }}
download_url: ${{ github.server_url }}/${{ github.repository }}/releases/download/${{ github.ref_name }}/${{ env.ADDON_NAME }}-${{ env.ADDON_VERSION }}.nvda-addon
source_url: ${{ github.server_url }}/${{ github.repository }}
token: ${{ secrets.USER_TOKEN }}