forked from multitheftauto/mtasa-blue
-
Notifications
You must be signed in to change notification settings - Fork 0
81 lines (75 loc) · 2.82 KB
/
rebuild-pots.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: "Rebuild en_US pot files"
on: [push, workflow_dispatch]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: mtasa
environment-file: utils/localization/environment.yml
python-version: 3
auto-activate-base: false
- name: Install gettext
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends gettext
- name: Run tests
run: pytest "utils/localization/tests"
shell: bash -l {0}
rebuild-pots:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.POT_CI_PAT }}
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: mtasa
environment-file: utils/localization/environment.yml
python-version: 3
auto-activate-base: false
- name: Install gettext
run: |
sudo apt-get update
sudo apt-get install --yes --no-install-recommends gettext
- run: python "utils/localization/build_gettext_catalog.py"
shell: bash -l {0}
- run: python "utils/localization/build_gettext_catalog_nsi.py"
shell: bash -l {0}
- id: stage_changes
name: Commit changes
run: |
# GitHub Actions bot user
git config --global user.name "Pot Bot"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# Check that diff contains something and it's not only POT-Creation-Date
if [[ $(git diff --unified=0 "Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot" | grep -v POT-Creation-Date | grep '^[+|-][^+|-]') ]]
then
git add "Shared/data/MTA San Andreas/MTA/locale/en_US/client.pot"
git commit -m "Update client en_US pot" -m "[ci skip]"
fi
# Check that diff contains something and it's not only POT-Creation-Date
if [[ $(git diff --unified=0 "Shared/installer/locale/en_US.pot" | grep -v POT-Creation-Date | grep '^[+|-][^+|-]') ]]
then
git add "Shared/installer/locale/en_US.pot"
git commit -m "Update installer en_US pot" -m "[ci skip]"
fi
# Check for local commits
if [[ $(git diff --name-only "@{upstream}..") ]]
then
echo "has_changes=true" >> $GITHUB_ENV
else
echo "has_changes=false" >> $GITHUB_ENV
fi
# Get rid of all other changes
git checkout -- .
git clean -fd
- if: ${{ env.has_changes == 'true' }}
name: Push changes
run: git push