-
Notifications
You must be signed in to change notification settings - Fork 40
83 lines (77 loc) · 3.13 KB
/
import_strings.yml
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
name: Import strings
on:
schedule:
- cron: "0 15 * * 2" # At 8:00 PDT on Tuesday
workflow_dispatch:
inputs:
type:
description: Type of update (standard, nofile, matchid)
required: true
default: "standard"
jobs:
build:
runs-on: macos-14
strategy:
max-parallel: 4
matrix:
xcode:
- "15.4"
steps:
- name: Clone l10n repository
uses: actions/checkout@v4
with:
path: "l10n_repo"
- name: Clone main code repository
uses: actions/checkout@v4
with:
repository: "mozilla-mobile/firefox-ios"
path: "code_repo"
- name: Select Xcode ${{ matrix.xcode }}
run: |
sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Python dependencies
run: |
pip install -r l10n_repo/.github/scripts/requirements.txt
- name: Run bootstrap script
run: |
# Unlink and re-link to prevent errors when GitHub macOS runner images
# install Python outside of brew.
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
brew update
brew install node
pip3 install virtualenv
cd code_repo
sh ./bootstrap.sh
- name: Extract strings
run: |
start_folder="$PWD"
# Clone localization tools and l10n repository
cd code_repo
git clone https://github.com/mozilla-mobile/LocalizationTools --depth 1
git clone https://github.com/mozilla-l10n/firefoxios-l10n --depth 1
# Extract strings
cd LocalizationTools
swift run LocalizationTools --export --project-path ../firefox-ios/Client.xcodeproj --l10n-project-path ../firefoxios-l10n --locale en-US
cp ../firefoxios-l10n/en-US/*.xliff "${start_folder}/l10n_repo/en-US/"
# Make sure that the reference locale (en-US) has translations, i.e.
# targets defined and identical to the source.
python "${start_folder}/l10n_repo/.github/scripts/translate_reference.py" --path "${start_folder}/l10n_repo/en-US"
# Copy strings over from es-ES to es
cp -r ../firefoxios-l10n/es-ES ../firefoxios-l10n/es
# Copy strings to other locales
python "${start_folder}/l10n_repo/.github/scripts/update_other_locales.py" --reference en-US --path "${start_folder}/l10n_repo" --type "${{ github.event.inputs.type }}"
- name: Get the current date for PR title
run: echo "current_date=$(date +"%Y-%m-%d")" >> $GITHUB_ENV
- run : git config --global user.email "flodolo@users.noreply.github.com"
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.IOS_L10N_TOKEN }}
path: "l10n_repo"
commit-message: "Extract new strings (${{ env.current_date }})"
branch: l10n_automation
delete-branch: true
title: "Extract new strings (${{ env.current_date }})"