-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (74 loc) · 2.25 KB
/
generate.yml
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
name: Generate nvda-cldr output
on:
workflow_dispatch:
push:
branches: [ main ]
jobs:
transformAndPush:
runs-on: ubuntu-latest
env:
# this is a git '--pretty=format' string
# %h is SHA, %n is newline,
# %s is commit message subject, %b is commit message body
COMMIT_FORMAT: "Generated from %h%n%nCommit message:%n%s%n%b"
strategy:
matrix:
python-version: [ 3.11 ]
steps:
- name: Current dir
run: |
pwd
ls -Al
- name: Checkout nvda-cldr data
uses: actions/checkout@v3
with:
repository: nvaccess/nvda-cldr
path: data
submodules: true
- name: Checkout gen branch into separate folder
uses: actions/checkout@v3
with:
repository: nvaccess/nvda-cldr
path: gen
ref: main-out
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Generate output with build.py
run: |
pwd
cd data
python build.py --loglevel DEBUG
- name: Empty destination directory
# empty the 'gen' folder directory, but don't delete .git, or the top level directory.
# rm -r is used to delete whole directories, therefore -maxdepth 1 is used to prevent recursing with
# find.
run: |
pwd
find gen/ -maxdepth 1 ! -name '.git' ! -name 'gen' -exec rm -r {} +
- name: Copy files
run: |
pwd
cd data
cp -r out/locale ../gen/locale/
- name: Commit and push
run: |
pwd
cd data
git log HEAD --pretty=format:"${{ env.COMMIT_FORMAT }}" -1 > ../commitMsg.txt
cd ../gen
if [[ `git status --porcelain` ]]; then
# Changes, use git status to add to log file for debugging.
echo Changes detected, committing.
git status --short
git config user.name github-actions
git config user.email [email protected]
git add .
git commit -F ../commitMsg.txt
git push
else
# No changes
echo No changes
fi