-
Notifications
You must be signed in to change notification settings - Fork 2
61 lines (58 loc) · 1.85 KB
/
upload-on-tag.yaml
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
name: Upload on new tags
on:
push:
tags:
'*'
env:
IS_DEV: ${{ contains(github.ref_name, '-dev-') }}
jobs:
buildAndUpload:
runs-on: ubuntu-latest
steps:
- name: Set my timezone # Useful when I push a release tag containing the date of today.
uses: szenius/set-timezone@v2
with:
timezoneLinux: "Europe/Paris"
#- name: Test timezone
# run: date +"%Z %z"
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install scons markdown
sudo apt update
sudo apt install gettext
- name: Extract change log
run: |
import re
pattern = r'[Vv](\d+.\d+.*?)(?:-dev-.*)?$'
refTag = '${{ github.ref_name }}'
print(f'===> Ref tag:{refTag}')
version = re.search(pattern, refTag).group(1)
print(f'===> Version:{version}')
pattern = rf'## Change log.*### Version {version}\s*(.*?)\s*(\n(### Version)|(\[\d+\]:)|$)'
fileContent = open('readme.md', 'r', encoding='utf8').read()
match = re.search(pattern, fileContent, re.DOTALL)
changeLog = match.group(1) if match else ""
changeLog += '\n'
print(f'===> ChangeLog:\n<<<{changeLog}>>>\n')
open('changelog.md', 'w', encoding='utf-8').write(changeLog)
shell: python
- name: Build add-on
run: scons dev=${{ env.IS_DEV }}
- name: Calculate sha256
run: sha256sum *.nvda-addon >> changelog.md
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
*.nvda-addon
name: Release ${{ github.ref_name }}
body_path: changelog.md
prerelease: ${{ env.IS_DEV }}