Repository navigation
160 lines (133 loc) · 3.94 KB
/
Copy pathbuild.yml
File metadata and controls
160 lines (133 loc) · 3.94 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
name: Build
on:
workflow_dispatch:
repository_dispatch:
types:
- update
push:
branches:
- main
paths:
- "automation/pyproject.toml"
- "automation/uv.lock"
- "**.py"
- "config.json"
- ".github/workflows/build.yml"
pull_request:
branches:
- main
paths:
- "automation/pyproject.toml"
- "automation/uv.lock"
- "**.py"
- "config.json"
- ".github/workflows/build.yml"
permissions:
contents: write
jobs:
generate-matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v7
- name: Read JSON matrix
id: set-matrix
run: |
matrix_json=$(cat config.json | jq -c '.')
echo "matrix=$matrix_json" >> $GITHUB_OUTPUT
echo "Generated matrix:"
echo "$matrix_json" | jq '.'
get-translations-backup:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v7
- name: Pull translations from translations-backup
run: |
rm -rf translation-backup
git clone https://github.com/dfint/translations-backup
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: translations-backup
path: translations-backup
include-hidden-files: false
produce-csv:
runs-on: ubuntu-latest
timeout-minutes: 60
needs:
- generate-matrix
- get-translations-backup
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-matrix.outputs.matrix) }}
steps:
- uses: actions/checkout@v7
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: translations-backup
path: translations-backup
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: 3.12
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
version: latest
- name: Remove old data
run: rm -rf translation_build
- name: Install library and dependencies
run: |
cd automation
uv sync --no-group dev
pipx install poethepoet
- name: Process po files
run: |
cd automation
poe process_one_language ../ "${{ matrix.name }}" "${{ matrix.code }}" "${{ matrix.encoding }}"
- name: Upload csv artifact
uses: actions/upload-artifact@v7
with:
name: artifact_csv_${{ matrix.code }}_${{ matrix.encoding }}
path: translation_build
push-changes:
needs: produce-csv
runs-on: ubuntu-latest
timeout-minutes: 60
if: always()
steps:
- uses: actions/checkout@v7
- name: Remove old data
run: rm -rf translation_build
- name: Download artifacts
uses: actions/download-artifact@v8
with:
pattern: artifact_*
merge-multiple: true
path: translation_build
# - name: Show changed files
# run: |
# echo "## Changed files" >> $GITHUB_STEP_SUMMARY
# git status --porcelain >> $GITHUB_STEP_SUMMARY
# echo "End" >> $GITHUB_STEP_SUMMARY
- name: Push changes to the repository
if: ${{ !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
uses: EndBug/add-and-commit@v11.1.1
with:
author_name: github-actions[bot]
author_email: 41898282+github-actions[bot]@users.noreply.github.com
trigger-update-data:
if: ${{ !contains(fromJSON('["push", "pull_request"]'), github.event_name) }}
needs: push-changes
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Dispatch dictionary manifest update
uses: peter-evans/repository-dispatch@v4
with:
token: ${{ secrets.REPOSITORY_DISPATCH_PAT }}
repository: dfint/update-data
event-type: dict