-
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathaction.yml
More file actions
166 lines (154 loc) · 5.43 KB
/
action.yml
File metadata and controls
166 lines (154 loc) · 5.43 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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
name: BGforge poify/unpoify
description: Update Gettext POT template from source language, extract translations from PO files, commit and push the files.
branding:
icon: message-circle
color: green
inputs:
poify:
description: run poify and msgmerge
default: "false"
required: false
poify_commit:
description: commit poify result
default: "true"
required: false
poify_trigger_unpoify_on_change:
description: |
Actions cannot self-trigger.
If poify+msgmerge resulted in PO update, which was commited into the repository, it will not trigger unpoify.
That gets translation files out of sync with POs for some time.
This setting enables instant unpoify after poify+merge, keeping translation files synced.
default: "true"
required: false
unpoify:
description: run unpoify
default: "false"
required: false
unpoify_commit:
description: commit unpoify result
default: "true"
required: false
dir2msgstr:
description: load manually updated translations into POs
default: "false"
required: false
dir2msgstr_commit:
description: commit dir2msgstr result
default: "true"
required: false
push:
description: push commits
default: "true"
required: false
single_commit:
description: make just one commit combining all changes made by the action
default: "false"
required: false
# https://github.com/BGforgeNet/handle-charsets
handle_charsets:
description: run handle-charsets
default: "false"
required: false
handle_charsets_tra_path:
description: handle-charsets source tra path
default: ""
required: false
handle_charsets_out_path:
description: handle-charsets converted tra path
default: ""
required: false
handle_charsets_from_utf8:
description: handle-charsets from_utf8
default: "false"
required: false
handle_charsets_split_console:
description: handle-charsets split_console
default: "false"
required: false
handle_charsets_commit:
description: handle-charsets commit
default: "true"
required: false
runs:
using: "composite"
steps:
- name: Install uv
uses: astral-sh/setup-uv@v7
- name: Initialize environment
shell: bash
run: |
set -xeu -o pipefail
if [ "$RUNNER_OS" = "Linux" ]; then
sudo apt-get install -y -qq -o=Dpkg::Use-Pty=0 gettext
elif [ "$RUNNER_OS" = "Windows" ]; then
wget https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.21-v1.16/gettext0.21-iconv1.16-static-32.zip -O gettext.zip
7z e gettext.zip bin/msgmerge.exe
mv msgmerge.exe "${GITHUB_ACTION_PATH}/msg2po/"
rm gettext.zip
else
echo "$RUNNER_OS not supported"
exit 1
fi
uv sync --project "$GITHUB_ACTION_PATH"
echo "${GITHUB_ACTION_PATH}/msg2po" >> $GITHUB_PATH
echo "PYTHONPATH=${GITHUB_ACTION_PATH}" >> $GITHUB_ENV
- name: Get path filters for checking changes
shell: bash
run: |
uv run --project "$GITHUB_ACTION_PATH" bgforge_config.py paths-filter > ../filters.yml
cat ../filters.yml
- name: Check changes
uses: AurorNZ/paths-filter@c9dd42e99db87803313ff6f4b1150cc9f6c836af
id: changes
with:
filters: ../filters.yml
- name: Poify
if: steps.changes.outputs.poify == 'true'
shell: bash
run: $GITHUB_ACTION_PATH/action/poify.sh
env:
INPUT_POIFY: ${{ inputs.poify }}
INPUT_POIFY_COMMIT: ${{ inputs.poify_commit }}
INPUT_POIFY_TRIGGER_UNPOIFY: ${{ inputs.poify_trigger_unpoify_on_change }}
INPUT_UNPOIFY_COMMIT: ${{ inputs.unpoify_commit }}
INPUT_SINGLE_COMMIT: ${{ inputs.single_commit }}
- name: Unpoify
if: steps.changes.outputs.unpoify == 'true'
shell: bash
run: $GITHUB_ACTION_PATH/action/unpoify.sh
env:
INPUT_UNPOIFY: ${{ inputs.unpoify }}
INPUT_UNPOIFY_COMMIT: ${{ inputs.unpoify_commit }}
INPUT_SINGLE_COMMIT: ${{ inputs.single_commit }}
- name: Load manual translation changes
if: steps.changes.outputs.dir2msgstr == 'true'
shell: bash
run: $GITHUB_ACTION_PATH/action/dir2msgstr.sh
env:
INPUT_DIR2MSGSTR: ${{ inputs.dir2msgstr }}
INPUT_DIR2MSGSTR_COMMIT: ${{ inputs.dir2msgstr_commit }}
INPUT_SINGLE_COMMIT: ${{ inputs.single_commit }}
- name: Handle charsets - separate commit
if: inputs.handle_charsets == 'true' && inputs.single_commit == 'false'
uses: BGforgeNet/handle-charsets@master
with:
tra_path: ${{ inputs.handle_charsets_tra_path }}
out_path: ${{ inputs.handle_charsets_out_path }}
from_utf8: ${{ inputs.handle_charsets_from_utf8 }}
split_console: ${{ inputs.handle_charsets_split_console }}
commit: true
- name: Handle charsets - single commit
if: inputs.handle_charsets == 'true' && inputs.single_commit == 'true'
uses: BGforgeNet/handle-charsets@master
with:
tra_path: ${{ inputs.handle_charsets_tra_path }}
out_path: ${{ inputs.handle_charsets_out_path }}
from_utf8: ${{ inputs.handle_charsets_from_utf8 }}
split_console: ${{ inputs.handle_charsets_split_console }}
commit: false
- name: Commit and push
shell: bash
run: $GITHUB_ACTION_PATH/action/push.sh
env:
INPUT_PUSH: ${{ inputs.push }}
INPUT_SINGLE_COMMIT: ${{ inputs.single_commit }}