forked from python/python-docs-pt-br
-
Notifications
You must be signed in to change notification settings - Fork 0
133 lines (127 loc) · 4.35 KB
/
update.yml
File metadata and controls
133 lines (127 loc) · 4.35 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
name: Update translations
on:
workflow_dispatch:
push:
paths:
- '.github/workflows/update.yml'
- 'scripts/update.sh'
branches:
- '*'
- '*/*'
- '**'
- '!3.?'
- '!2.*'
schedule:
- cron: '0 23 * * *'
env:
CPYTHON_BRANCH: '3.10'
LANGUAGE: 'pt_BR'
jobs:
update:
# Job to pull translation from Transifex platform, and commit & push changes
runs-on: ubuntu-latest
steps:
- name: Check out ${{ github.repository }}
uses: actions/checkout@v2
- name: Check out CPython
uses: actions/checkout@v2
with:
repository: python/cpython
persist-credentials: false
ref: ${{ env.CPYTHON_BRANCH }}
path: cpython
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: |
sudo apt update -y && sudo apt install gettext -y
pip3 install --upgrade pip
pip3 install -r requirements.txt -r cpython/Doc/requirements.txt
- name: Update translations
run: |
sh scripts/update.sh
env:
TX_TOKEN: ${{ secrets.TX_TOKEN }}
LANGUAGE: ${{ env.LANGUAGE }}
- name: Wrap catalog message files
run: |
powrap --modified
- name: Commit and push changes
if: github.repository == 'rffontenelle/python-docs-pt-br'
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git status
git add -A
git diff-index --quiet HEAD || ( git commit -m "Update translations from Transifex" && git push )
merge:
# Merge translations previously updated into older branches to make sure
# older versions of Python Docs gets translated as well.
# 'overwrite=true' means strings previously translated will get overwritten;
# other branches will preserve translated strings, only filling in new
# translations.
name: merge into ${{ matrix.branch }}
needs: [update]
strategy:
matrix:
branch: [ 3.9, 3.8, 3.7, 3.6, 2.7 ]
include:
- branch: 3.9
overwrite: true
runs-on: ubuntu-latest
steps:
- name: Get current branch name
shell: bash
run:
echo "CURRENT_BRANCH=$(echo ${GITHUB_REF#refs/heads/} | tr / -)" >> $GITHUB_ENV
- name: Check out source branch (${{ env.CURRENT_BRANCH }})
uses: actions/checkout@v2
with:
path: ${{ env.CURRENT_BRANCH }}
persist-credentials: false
- name: Check out target branch (${{ matrix.branch }})
uses: actions/checkout@v2
with:
ref: ${{ matrix.branch }}
path: ${{ matrix.branch }}
- name: Install dependencies
run: |
sudo apt update -y && sudo apt install gettext -y
pip3 install pomerge powrap
- name: Merge overwriting on stable release branch
if: ${{ matrix.overwrite == true }}
run: |
pomerge --from ${{ env.CURRENT_BRANCH }}/**/*.po --to ${{ matrix.branch }}/**/*.po
- name: Merge without overwriting on EOL or security-fix release branch
if: ${{ matrix.overwrite != true }}
run: |
pomerge --no-overwrite --from ${{ env.CURRENT_BRANCH }}/**/*.po --to ${{ matrix.branch }}/**/*.po
- name: Wrap catalog message files
run: |
powrap --modified -C ${{ matrix.branch }}
- name: Commit and push changes
if: github.repository == 'rffontenelle/python-docs-pt-br'
run: |
cd ${{ matrix.branch }}
git config user.name github-actions
git config user.email github-actions@github.com
git status
git add -A
git diff-index --quiet HEAD || ( git commit -m "Merge ${{ env.CURRENT_BRANCH }} into ${{ matrix.branch }}" && git push )
call-build:
# Call the build workflow after updating
name: call
needs: [update]
uses: rffontenelle/python-docs-pt-br/.github/workflows/build.yml@3.10
with:
was-called: yes
secrets:
TELEGRAM_TO: ${{ secrets.TELEGRAM_TO }}
TELEGRAM_TOKEN: ${{ secrets.TELEGRAM_TOKEN }}
call-compendium:
# Call the compendium workflow after updating
name: call
needs: [update]
uses: rffontenelle/python-docs-pt-br/.github/workflows/compendium.yml@3.10