Update Finnish translation to 2024-01-01 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy To S3 | |
on: | |
push: | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.CI_CD_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.CI_CD_AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_DEFAULT_REGION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install wrc | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
# install font libraries | |
sudo apt-get update -qq && \ | |
sudo apt-get install --no-install-recommends -y \ | |
fonts-unfonts-core \ | |
fonts-wqy-microhei \ | |
fonts-ipafont \ | |
lmodern \ | |
libxrender1 | |
# install wkhtmltopdf | |
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz -O wkhtml.tar.xz && sudo tar -xf wkhtml.tar.xz --strip-components=1 -C /usr/local | |
- name: Build and deploy to S3 | |
run: | | |
outputdir=/tmp/translations | |
languages=$(wrc-languages) | |
git_hash=$(git rev-parse --short "$GITHUB_SHA") | |
# Build all translations | |
for kind in html pdf; do | |
for l in $languages; do | |
lang_inputdir=./${l} | |
lang_outputdir=$outputdir/${l} | |
mkdir -p $lang_outputdir | |
echo "Generating ${kind} for language ${l}" | |
wrc --target=$kind -g $git_hash -l $l -o $lang_outputdir $lang_inputdir | |
# Update timestamp for semi-automatic computation of translations index | |
cp $lang_inputdir/metadata.json $lang_outputdir/ | |
done | |
done | |
# Update version built | |
echo "$git_hash" > $outputdir/version | |
# Update timestamps for automatically determining which regulations are up to date | |
cp ./version-date $outputdir/ | |
aws s3 sync $outputdir s3://wca-regulations/translations --acl public-read |