Update to version 44 (#6) #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |